From 507ec1de34858aed7872e60a096f043a975ab3c9 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Wed, 13 Dec 2023 07:53:00 +0100 Subject: [PATCH] Upstream fetch (#1) * feat: secp256k1 public key constant time (#18026) Signed-off-by: bizk * chore: Fixed changelog duplicated items (#18628) * adr: Un-Ordered Transaction Inclusion (#18553) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Aleksandr Bezobchuk * docs: lint ADR-070 (#18634) * fix(baseapp)!: postHandler should run regardless of result (#18627) * docs: fix typos in adr-007-specialization-groups.md (#18635) * chore: alphabetize labels (#18640) * docs(x/circuit): add note on ante handler (#18637) Co-authored-by: Aleksandr Bezobchuk * fix: telemetry metric label variable (#18643) * chore: typos fix (#18642) * refactor(store/v2): updates from integration (#18633) * build(deps): Bump actions/setup-go from 4 to 5 (#18647) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * feat(store/v2): snapshot manager (#18458) * chore(client/v2): fix typos in the README.md (#18657) * fix(baseapp): protocompat.go gogoproto.Merge does not work with custom types (#18654) Co-authored-by: unknown unknown * chore: fix several minor typos (#18660) * chore(tools/confix/cmd): fix typo in view.go (#18659) * refactor(x/staking): check duplicate addresses in StakeAuthorization's params (#18655) * feat(accounts): use gogoproto API instead of protov2. (#18653) Co-authored-by: unknown unknown Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix(store/commitment/iavl): honor tree.Remove error firstly (#18651) * build(deps): Bump actions/stale from 8 to 9 (#18656) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(docs): fix typos & wording in docs (#18667) * chore: fix several typos. (#18666) * feat(telemetry): enable `statsd` and `dogstatsd` telemetry sinks (#18646) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Aleksandr Bezobchuk Co-authored-by: marbar3778 Co-authored-by: Marko * feat(store/v2): add SetInitialVersion in SC (#18665) * feat(client/keys): support display discreetly for `keys add` (#18663) Co-authored-by: Julien Robert * ci: add misspell action (#18671) * chore: typos fix by misspell-fixer (#18683) Co-authored-by: github-merge-queue Co-authored-by: Julien Robert * chore: add v0.50.2 changelog to main (#18682) * build(deps): Bump github.com/jhump/protoreflect from 1.15.3 to 1.15.4 in /tests (#18678) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * refactor(bank): remove .String() calls (#18175) Co-authored-by: Facundo * ci: use codespell instead of misspell-fixer (#18686) Co-authored-by: Marko * feat(gov): add proposal types and spam votes (#18532) * feat(accounts): use account number as state prefix for account state (#18664) Co-authored-by: unknown unknown * chore: typos fixes by cosmos-sdk bot (#18689) Co-authored-by: github-merge-queue Co-authored-by: Julien Robert Co-authored-by: marbar3778 * feat(client/keys): support display discreetly for keys mnemonic (#18688) * refactor: remove panic usage in keeper methods (#18636) * ci: rename pr name in misspell job (#18693) Co-authored-by: Marko * build(deps): Bump github.com/pelletier/go-toml/v2 from 2.1.0 to 2.1.1 in /tools/confix (#18702) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * feat(client/keys): support display discreetly for keys export (#18684) * feat(x/gov): better gov genesis validation (#18707) --------- Signed-off-by: bizk Signed-off-by: dependabot[bot] Co-authored-by: Carlos Santiago Yanzon <27785807+bizk@users.noreply.github.com> Co-authored-by: yihuang Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Aleksandr Bezobchuk Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Co-authored-by: Akaonetwo <107335783+Akare123@users.noreply.github.com> Co-authored-by: Marko Co-authored-by: Julien Robert Co-authored-by: dreamweaverxyz <153101746+dreamweaverxyz@users.noreply.github.com> Co-authored-by: Pioua <136521243+dzizazda@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com> Co-authored-by: leonarddt05 <139609434+leonarddt05@users.noreply.github.com> Co-authored-by: testinginprod <98415576+testinginprod@users.noreply.github.com> Co-authored-by: unknown unknown Co-authored-by: Sukey <35202440+sukey2008@users.noreply.github.com> Co-authored-by: axie <152680487+azukiboy@users.noreply.github.com> Co-authored-by: Luke Ma <867273263@qq.com> Co-authored-by: Emmanuel T Odeke Co-authored-by: 0xn4de <109149873+0xn4de@users.noreply.github.com> Co-authored-by: hattizai <150505746+hattizai@users.noreply.github.com> Co-authored-by: Devon Bear Co-authored-by: Marko Co-authored-by: Halimao <1065621723@qq.com> Co-authored-by: Cosmos SDK <113218068+github-prbot@users.noreply.github.com> Co-authored-by: github-merge-queue Co-authored-by: Facundo Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> --- .github/.codespellignore | 4 + .github/pr_labeler.yml | 64 +- .github/workflows/build.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependabot-update-all.yml | 2 +- .github/workflows/dependencies-review.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/misspell.yml | 28 + .github/workflows/release-confix.yml | 2 +- .github/workflows/release-cosmovisor.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/sims-047.yml | 10 +- .github/workflows/sims-050.yml | 10 +- .github/workflows/sims-nightly.yml | 4 +- .github/workflows/sims.yml | 8 +- .github/workflows/stale.yml | 2 +- .github/workflows/starship-tests.yml | 2 +- .github/workflows/test.yml | 74 +- CHANGELOG.md | 91 +- CODING_GUIDELINES.md | 2 +- CONTRIBUTING.md | 6 +- RELEASE_PROCESS.md | 4 +- ROADMAP.md | 6 +- UPGRADING.md | 8 +- api/cosmos/accounts/v1/genesis.pulsar.go | 154 +- api/cosmos/accounts/v1/query.pulsar.go | 278 +-- api/cosmos/accounts/v1/tx.pulsar.go | 412 ++-- api/cosmos/authz/v1beta1/event.pulsar.go | 4 +- .../reflection/v2alpha1/reflection.pulsar.go | 4 +- api/cosmos/gov/v1/genesis.pulsar.go | 8 +- api/cosmos/gov/v1/gov.pulsar.go | 627 +++++-- api/cosmos/gov/v1/query.pulsar.go | 2 +- api/cosmos/gov/v1/tx.pulsar.go | 437 +++-- api/cosmos/msg/textual/v1/textual.pulsar.go | 2 +- api/cosmos/staking/v1beta1/staking.pulsar.go | 4 +- api/tendermint/abci/types.pulsar.go | 2 +- api/tendermint/crypto/proof.pulsar.go | 2 +- baseapp/abci.go | 2 +- baseapp/baseapp.go | 33 +- baseapp/baseapp_test.go | 47 + baseapp/internal/protocompat/protocompat.go | 18 +- client/config/config_test.go | 2 +- client/debug/main.go | 2 +- client/docs/swagger-ui/swagger.yaml | 28 +- client/input/input_test.go | 2 +- client/keys/add.go | 38 +- client/keys/export.go | 21 +- client/keys/export_test.go | 33 +- client/keys/mnemonic.go | 7 +- client/keys/mnemonic_test.go | 31 +- client/keys/utils.go | 15 + client/tx/tx.go | 2 +- client/v2/README.md | 4 +- client/v2/go.mod | 8 +- client/v2/go.sum | 10 +- codec/codec.go | 2 +- codec/unknownproto/unknown_fields.go | 18 +- collections/README.md | 4 +- collections/colltest/codec.go | 2 +- contrib/images/simd-dlv/README.md | 2 +- crypto/hd/algo.go | 8 +- crypto/hd/hdpath.go | 2 +- crypto/keyring/keyring_test.go | 6 +- crypto/keys/secp256k1/bench_test.go | 2 +- .../internal/secp256k1/scalar_mult_cgo.go | 10 +- .../internal/secp256k1/secp256_test.go | 1 + crypto/keys/secp256k1/secp256k1.go | 25 +- crypto/keys/secp256k1/secp256k1_cgo_test.go | 1 - .../keys/secp256k1/secp256k1_internal_test.go | 4 +- crypto/keys/secp256k1/secp256k1_nocgo_test.go | 27 +- crypto/keys/secp256k1/secp256k1_test.go | 11 + crypto/ledger/ledger_secp256k1.go | 9 +- docs/architecture/PROCESS.md | 2 +- docs/architecture/README.md | 1 + .../adr-007-specialization-groups.md | 4 +- .../adr-014-proportional-slashing.md | 2 +- .../adr-018-extendable-voting-period.md | 2 +- .../adr-021-protobuf-query-encoding.md | 2 +- docs/architecture/adr-031-msg-service.md | 6 +- docs/architecture/adr-032-typed-events.md | 4 +- docs/architecture/adr-034-account-rekeying.md | 2 +- docs/architecture/adr-037-gov-split-vote.md | 2 +- docs/architecture/adr-038-state-listening.md | 4 +- docs/architecture/adr-039-epoched-staking.md | 2 +- .../adr-041-in-place-store-migrations.md | 2 +- docs/architecture/adr-042-group-module.md | 2 +- docs/architecture/adr-048-consensus-fees.md | 2 +- docs/architecture/adr-049-state-sync-hooks.md | 2 +- .../adr-050-sign-mode-textual-annex2.md | 6 +- .../architecture/adr-050-sign-mode-textual.md | 6 +- docs/architecture/adr-061-liquid-staking.md | 2 +- docs/architecture/adr-063-core-module-api.md | 6 +- docs/architecture/adr-064-abci-2.0.md | 2 +- docs/architecture/adr-067-simulator-v2.md | 4 +- docs/architecture/adr-069-gov-improvements.md | 8 +- .../architecture/adr-070-unordered-account.md | 260 +++ .../building-modules/01-module-manager.md | 2 +- docs/learn/advanced/01-transactions.md | 2 +- docs/learn/advanced/07-cli.md | 2 +- docs/learn/advanced/11-runtx_middleware.md | 2 +- docs/rfc/rfc-001-tx-validation.md | 2 +- docs/rfc/rfc-template.md | 2 +- docs/spec/SPEC_MODULE.md | 2 +- docs/spec/SPEC_STANDARD.md | 2 +- docs/spec/addresses/bech32.md | 2 +- docs/spec/fee_distribution/f1_fee_distr.tex | 4 +- docs/spec/store/README.md | 6 +- go.mod | 13 +- go.sum | 20 +- internal/conv/doc.go | 2 +- math/dec.go | 2 +- orm/README.md | 4 +- proto/buf.yaml | 1 + .../account_abstraction/v1/interface.proto | 2 + .../accounts/testing/counter/v1/counter.proto | 2 + .../testing/rotation/v1/partial.proto | 2 + proto/cosmos/accounts/v1/genesis.proto | 4 +- proto/cosmos/accounts/v1/query.proto | 6 +- proto/cosmos/accounts/v1/tx.proto | 15 +- proto/cosmos/authz/v1beta1/event.proto | 4 +- .../base/reflection/v2alpha1/reflection.proto | 4 +- proto/cosmos/gov/v1/genesis.proto | 8 +- proto/cosmos/gov/v1/gov.proto | 53 +- proto/cosmos/gov/v1/query.proto | 2 +- proto/cosmos/gov/v1/tx.proto | 11 +- proto/cosmos/msg/textual/v1/textual.proto | 2 +- proto/cosmos/staking/v1beta1/staking.proto | 4 +- proto/tendermint/abci/types.proto | 2 +- proto/tendermint/crypto/proof.proto | 2 +- server/config/config.go | 2 +- server/config/toml.go | 13 +- .../grpc/reflection/v2alpha1/reflection.pb.go | 4 +- server/mock/store.go | 2 +- simapp/app.go | 3 +- simapp/app_config.go | 2 +- simapp/go.mod | 13 +- simapp/go.sum | 20 +- simapp/gomod2nix.toml | 37 +- simapp/simd/cmd/config.go | 2 +- store/CHANGELOG.md | 6 +- store/changeset.go | 5 +- store/commit_info.go | 12 +- store/commitment/iavl/exporter.go | 40 + store/commitment/iavl/importer.go | 34 + store/commitment/iavl/tree.go | 39 +- store/commitment/iavl/tree_test.go | 22 +- store/commitment/store.go | 160 +- store/commitment/store_test_suite.go | 121 ++ store/commitment/tree.go | 24 + store/database.go | 1 + store/gas.go | 2 +- store/go.mod | 7 +- store/go.sum | 57 +- store/kv/branch/store_test.go | 10 +- store/proof.go | 98 + store/pruning/manager.go | 9 + store/pruning/manager_test.go | 6 +- store/root/store.go | 41 +- store/root/store_test.go | 21 +- store/snapshots/chunk.go | 8 +- store/snapshots/helpers_test.go | 140 +- store/snapshots/manager.go | 66 +- store/snapshots/manager_test.go | 40 +- store/snapshots/{types => }/options.go | 2 +- store/snapshots/{types => }/snapshotter.go | 39 +- store/storage/database.go | 25 + store/storage/pebbledb/db.go | 35 +- store/storage/pebbledb/db_test.go | 2 +- store/storage/rocksdb/db.go | 27 +- store/storage/rocksdb/db_test.go | 9 +- store/storage/sqlite/db.go | 30 +- store/storage/sqlite/db_test.go | 24 +- store/storage/storage_bench_test.go | 16 +- store/storage/store.go | 130 ++ store/store.go | 26 +- telemetry/metrics.go | 74 +- telemetry/metrics_test.go | 2 + .../e2e/accounts/account_abstraction_test.go | 64 +- tests/e2e/accounts/setup_test.go | 13 - tests/e2e/auth/suite.go | 29 +- tests/e2e/bank/suite.go | 15 +- tests/go.mod | 18 +- tests/go.sum | 22 +- .../integration/auth/client/cli/suite_test.go | 27 +- tests/integration/bank/app_test.go | 10 +- tests/integration/gov/genesis_test.go | 4 +- .../integration/gov/keeper/grpc_query_test.go | 178 +- tests/integration/gov/keeper/tally_test.go | 32 +- tests/starship/README.md | 2 +- tests/starship/configs/devnet.yaml | 2 +- tests/starship/tests/go.mod | 8 +- tests/starship/tests/go.sum | 10 +- tests/starship/tests/transfer_test.go | 2 +- testutil/key.go | 4 +- testutil/network/network.go | 2 +- tools/confix/CHANGELOG.md | 2 + tools/confix/cmd/migrate_test.go | 2 +- tools/confix/cmd/view.go | 6 +- tools/confix/data/v0.45-app.toml | 2 +- tools/confix/data/v0.46-app.toml | 4 +- tools/confix/data/v0.47-app.toml | 4 +- tools/confix/data/v0.50-app.toml | 13 +- tools/confix/data/v0.51-app.toml | 13 +- tools/confix/go.mod | 2 +- tools/confix/go.sum | 4 +- tools/cosmovisor/README.md | 6 +- tools/cosmovisor/go.mod | 2 +- tools/cosmovisor/go.sum | 4 +- tools/cosmovisor/process.go | 4 +- tools/cosmovisor/scanner.go | 2 +- tools/hubl/go.mod | 2 +- tools/hubl/go.sum | 4 +- types/address.go | 4 +- types/address_race_test.go | 4 +- types/coin_test.go | 2 +- types/mempool/priority_nonce_spec.md | 2 +- types/module/module.go | 2 +- types/router.go | 2 +- types/tx/signing/signature.go | 6 +- x/accounts/account_test.go | 39 +- x/accounts/accountstd/exports.go | 28 +- x/accounts/cli/cli.go | 83 +- x/accounts/genesis.go | 29 +- x/accounts/genesis_test.go | 27 +- x/accounts/go.mod | 8 +- x/accounts/go.sum | 16 +- .../account_abstraction/v1/interface.pb.go | 1671 +++++++++++++++++ .../internal/implementation/account_test.go | 27 +- .../internal/implementation/api_builder.go | 71 +- .../implementation/api_builder_test.go | 10 +- x/accounts/internal/implementation/context.go | 29 +- .../internal/implementation/context_test.go | 38 +- .../internal/implementation/encoding.go | 59 + .../internal/implementation/implementation.go | 77 +- .../implementation/implementation_test.go | 95 +- .../internal/implementation/proto_util.go | 31 - .../internal/implementation/protoaccount.go | 68 +- .../internal/prefixstore/prefixstore.go | 2 +- x/accounts/keeper.go | 125 +- x/accounts/keeper_account_abstraction.go | 36 +- x/accounts/keeper_test.go | 48 +- x/accounts/msg_server.go | 40 +- x/accounts/msg_server_test.go | 15 +- x/accounts/query_server.go | 19 +- x/accounts/query_server_test.go | 23 +- .../testing/account_abstraction/full.go | 2 +- .../testing/account_abstraction/minimal.go | 4 +- x/accounts/testing/counter/counter.go | 2 +- x/accounts/testing/counter/v1/counter.pb.go | 1018 ++++++++++ x/accounts/testing/rotation/v1/partial.pb.go | 740 ++++++++ x/accounts/utils_test.go | 29 +- x/accounts/v1/genesis.pb.go | 64 +- x/accounts/v1/query.pb.go | 129 +- x/accounts/v1/tx.pb.go | 209 ++- x/auth/CHANGELOG.md | 2 - x/auth/ante/sigverify.go | 2 +- x/auth/ante/sigverify_test.go | 18 +- x/auth/go.mod | 8 +- x/auth/go.sum | 10 +- x/auth/tx/README.md | 2 +- x/auth/vesting/README.md | 6 +- x/authz/README.md | 4 +- x/authz/event.pb.go | 4 +- x/authz/go.mod | 8 +- x/authz/go.sum | 10 +- x/authz/simulation/operations.go | 11 +- x/bank/README.md | 2 +- x/bank/client/cli/tx_test.go | 26 +- x/bank/go.mod | 8 +- x/bank/go.sum | 10 +- x/bank/keeper/grpc_query_test.go | 5 +- x/bank/keeper/keeper.go | 54 +- x/bank/keeper/keeper_test.go | 41 +- x/bank/keeper/send.go | 34 +- x/bank/keeper/view.go | 10 +- x/bank/module.go | 19 +- x/bank/simulation/operations.go | 49 +- x/bank/simulation/operations_test.go | 18 +- x/bank/types/events.go | 16 +- x/bank/types/msgs.go | 4 +- x/bank/types/msgs_test.go | 4 +- x/bank/types/querier.go | 4 +- x/bank/types/restrictions_test.go | 4 +- x/bank/types/send_authorization_test.go | 29 +- x/circuit/README.md | 60 +- x/circuit/go.mod | 8 +- x/circuit/go.sum | 10 +- x/distribution/go.mod | 11 +- x/distribution/go.sum | 10 +- x/distribution/keeper/allocation.go | 2 +- x/distribution/keeper/delegation.go | 19 +- x/distribution/keeper/grpc_query.go | 16 +- x/evidence/go.mod | 8 +- x/evidence/go.sum | 10 +- x/feegrant/go.mod | 8 +- x/feegrant/go.sum | 10 +- x/feegrant/migrations/v2/keys.go | 2 +- x/genutil/client/cli/genaccount_test.go | 2 +- x/genutil/gentx_test.go | 10 +- x/gov/CHANGELOG.md | 14 + x/gov/README.md | 81 +- x/gov/abci.go | 13 +- x/gov/abci_test.go | 73 +- x/gov/client/cli/tx.go | 4 +- x/gov/client/cli/util.go | 33 +- x/gov/client/cli/util_test.go | 4 +- x/gov/client/utils/utils.go | 62 +- x/gov/client/utils/utils_test.go | 14 +- x/gov/go.mod | 10 +- x/gov/go.sum | 10 +- x/gov/keeper/common_test.go | 4 +- x/gov/keeper/deposit.go | 7 +- x/gov/keeper/deposit_test.go | 27 +- x/gov/keeper/export_test.go | 10 +- x/gov/keeper/grpc_query_test.go | 31 +- x/gov/keeper/hooks_test.go | 4 +- x/gov/keeper/keeper_test.go | 14 +- x/gov/keeper/migrations.go | 6 + x/gov/keeper/msg_server.go | 11 +- x/gov/keeper/msg_server_test.go | 94 +- x/gov/keeper/proposal.go | 7 +- x/gov/keeper/proposal_test.go | 80 +- x/gov/keeper/tally.go | 6 + x/gov/keeper/tally_test.go | 160 +- x/gov/keeper/vote_test.go | 2 +- x/gov/migrations/v3/convert_test.go | 4 + x/gov/migrations/v6/store.go | 29 + x/gov/migrations/v6/store_test.go | 3 + x/gov/module.go | 6 +- x/gov/simulation/operations.go | 11 +- x/gov/simulation/operations_test.go | 8 +- x/gov/types/config.go | 2 +- x/gov/types/v1/genesis.go | 73 +- x/gov/types/v1/genesis.pb.go | 8 +- x/gov/types/v1/genesis_test.go | 104 +- x/gov/types/v1/gov.pb.go | 368 +++- x/gov/types/v1/msgs.go | 4 +- x/gov/types/v1/msgs_test.go | 28 +- x/gov/types/v1/params.go | 6 +- x/gov/types/v1/proposal.go | 14 +- x/gov/types/v1/proposals_test.go | 16 +- x/gov/types/v1/query.pb.go | 2 +- x/gov/types/v1/tally.go | 17 +- x/gov/types/v1/tx.pb.go | 185 +- x/gov/types/v1/vote.go | 27 +- x/group/README.md | 4 +- x/group/go.mod | 8 +- x/group/go.sum | 10 +- .../internal/orm/sequence_property_test.go | 2 +- x/mint/go.mod | 8 +- x/mint/go.sum | 10 +- x/nft/go.mod | 8 +- x/nft/go.sum | 10 +- x/nft/internal/conv/doc.go | 2 +- x/nft/keeper/nft_batch_test.go | 6 +- x/nft/simulation/operations.go | 4 +- x/params/README.md | 2 +- x/params/go.mod | 8 +- x/params/go.sum | 10 +- x/params/types/querier.go | 2 +- x/protocolpool/go.mod | 8 +- x/protocolpool/go.sum | 10 +- x/simulation/log.go | 8 +- x/simulation/simulate.go | 2 +- x/slashing/README.md | 2 +- x/slashing/go.mod | 8 +- x/slashing/go.sum | 10 +- x/slashing/keeper/signing_info.go | 10 +- x/staking/README.md | 4 +- x/staking/go.mod | 8 +- x/staking/go.sum | 10 +- x/staking/keeper/alias_functions.go | 7 +- x/staking/keeper/delegation.go | 30 +- x/staking/keeper/keeper_test.go | 4 +- x/staking/keeper/slash.go | 18 +- x/staking/keeper/val_state_change.go | 22 +- x/staking/keeper/validator.go | 25 +- x/staking/types/authz.go | 10 + x/staking/types/authz_test.go | 8 + x/staking/types/staking.pb.go | 4 +- x/upgrade/CHANGELOG.md | 2 + x/upgrade/README.md | 2 +- x/upgrade/go.mod | 8 +- x/upgrade/go.sum | 10 +- x/upgrade/internal/conv/doc.go | 2 +- x/upgrade/plan/info.go | 2 +- 386 files changed, 9413 insertions(+), 3418 deletions(-) create mode 100644 .github/.codespellignore create mode 100644 .github/workflows/misspell.yml create mode 100644 docs/architecture/adr-070-unordered-account.md create mode 100644 store/commitment/iavl/exporter.go create mode 100644 store/commitment/iavl/importer.go create mode 100644 store/commitment/store_test_suite.go create mode 100644 store/proof.go rename store/snapshots/{types => }/options.go (96%) rename store/snapshots/{types => }/snapshotter.go (55%) create mode 100644 store/storage/database.go create mode 100644 store/storage/store.go delete mode 100644 tests/e2e/accounts/setup_test.go create mode 100644 x/accounts/interfaces/account_abstraction/v1/interface.pb.go create mode 100644 x/accounts/internal/implementation/encoding.go delete mode 100644 x/accounts/internal/implementation/proto_util.go create mode 100644 x/accounts/testing/counter/v1/counter.pb.go create mode 100644 x/accounts/testing/rotation/v1/partial.pb.go create mode 100644 x/gov/migrations/v6/store.go create mode 100644 x/gov/migrations/v6/store_test.go diff --git a/.github/.codespellignore b/.github/.codespellignore new file mode 100644 index 000000000000..f70d9539584a --- /dev/null +++ b/.github/.codespellignore @@ -0,0 +1,4 @@ +cips +pullrequest +keypair +pastTime \ No newline at end of file diff --git a/.github/pr_labeler.yml b/.github/pr_labeler.yml index 76cc7bc59c21..4776f36cbda7 100644 --- a/.github/pr_labeler.yml +++ b/.github/pr_labeler.yml @@ -1,3 +1,25 @@ +"C:CLI": + - client/**/* + - x/*/client/**/* +"C:Confix": + - tools/confix/**/* +"C:Cosmovisor": + - tools/cosmovisor/**/* +"C:Hubl": + - tools/hubl/**/* +"C:Keys": + - client/keys/**/* +"C:Simulations": + - x/simulation/**/* + - x/*/simulation/**/* +"C:Store": + - store/**/* +"C:collections": + - collections/**/* +"C:log": + - log/* +"C:orm": + - orm/**/* "C:x/accounts": - x/accounts/**/* "C:x/auth": @@ -6,6 +28,10 @@ - x/authz/**/* "C:x/bank": - x/bank/**/* +"C:x/circuit": + - x/circuit/**/* +"C:x/consensus": + - x/consensus/**/* "C:x/crisis": - x/crisis/**/* "C:x/distribution": @@ -26,33 +52,18 @@ - x/nft/**/* "C:x/params": - x/params/**/* -"C:Simulations": - - x/simulation/**/* - - x/*/simulation/**/* +"C:x/protocolpool": + - x/protocolpool/**/* "C:x/slashing": - x/slashing/**/* "C:x/staking": - x/staking/**/* -"C:x/upgrade": - - x/upgrade/**/* -"C:x/consensus": - - x/consensus/**/* -"C:x/circuit": - - x/circuit/**/* -"C:x/protocolpool": - - x/protocolpool/**/* "C:x/tx": - x/tx/**/* -"C:collections": - - collections/**/* -"C:Cosmovisor": - - tools/cosmovisor/**/* -"C:Confix": - - tools/confix/**/* -"C:Hubl": - - tools/hubl/**/* -"C:Keys": - - client/keys/**/* +"C:x/upgrade": + - x/upgrade/**/* +"Type: ADR": + - docs/architecture/**/* "Type: Build": - Makefile - Dockerfile @@ -63,14 +74,3 @@ - buf.yaml - .mergify.yml - .golangci.yml -"C:CLI": - - client/**/* - - x/*/client/**/* -"Type: ADR": - - docs/architecture/**/* -"C:Store": - - store/**/* -"C:orm": - - orm/**/* -"C:log": - - log/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d23881ed7575..7f2e1f418f68 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 22a64763b230..e7c8ce4544f8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/dependabot-update-all.yml b/.github/workflows/dependabot-update-all.yml index 129ae63fb55c..0bf09c8b06d1 100644 --- a/.github/workflows/dependabot-update-all.yml +++ b/.github/workflows/dependabot-update-all.yml @@ -15,7 +15,7 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} # Secret to be added in the repo under Settings > Secrets > Dependabot token: ${{ secrets.PRBOT_PAT }} - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/dependencies-review.yml b/.github/workflows/dependencies-review.yml index c0e4c79e6378..d7a736ff8d88 100644 --- a/.github/workflows/dependencies-review.yml +++ b/.github/workflows/dependencies-review.yml @@ -12,7 +12,7 @@ jobs: steps: - name: "Checkout Repository" uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 532840fccb69..674ffb9a0575 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/misspell.yml b/.github/workflows/misspell.yml new file mode 100644 index 000000000000..219bb1727077 --- /dev/null +++ b/.github/workflows/misspell.yml @@ -0,0 +1,28 @@ +name: Fix typos nightly + +on: + schedule: + - cron: "0 12 * * *" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Run codespell + continue-on-error: true + run: | + sudo apt-get install codespell -y + codespell -w --skip="*.pulsar.go,*.pb.go,*.pb.gw.go,*.cosmos_orm.go,*.json,*.git,*.js,crypto/keys,fuzz,*.h" --ignore-words=".github/.codespellignore" + - uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.PRBOT_PAT }} + commit-message: "chore: spelling errors fixes" + title: "chore: fix spelling errors" + branch: "bot/fix-typos" + delete-branch: true + body: | + This PR fixes typos in the codebase. + Please review it, and merge if everything is fine. + If there are proto changes, run `make proto-gen` and commit the changes. diff --git a/.github/workflows/release-confix.yml b/.github/workflows/release-confix.yml index 60e6bf53ca4b..d284fd5551e0 100644 --- a/.github/workflows/release-confix.yml +++ b/.github/workflows/release-confix.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/release-cosmovisor.yml b/.github/workflows/release-cosmovisor.yml index 8b7d0335bcac..38a58b4a7201 100644 --- a/.github/workflows/release-cosmovisor.yml +++ b/.github/workflows/release-cosmovisor.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb031d3ec8e8..d0d88133bd62 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/sims-047.yml b/.github/workflows/sims-047.yml index 28e7f97ced5a..f0bef153d0bc 100644 --- a/.github/workflows/sims-047.yml +++ b/.github/workflows/sims-047.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.47.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest needs: build steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.47.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -69,7 +69,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.47.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -88,7 +88,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.47.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/sims-050.yml b/.github/workflows/sims-050.yml index d3f28a078277..ae236a5c9d78 100644 --- a/.github/workflows/sims-050.yml +++ b/.github/workflows/sims-050.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.50.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest needs: build steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.50.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -69,7 +69,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.50.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -88,7 +88,7 @@ jobs: - uses: actions/checkout@v4 with: ref: "release/v0.50.x" - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/sims-nightly.yml b/.github/workflows/sims-nightly.yml index a34889eeec3c..f28e6b9d3627 100644 --- a/.github/workflows/sims-nightly.yml +++ b/.github/workflows/sims-nightly.yml @@ -20,7 +20,7 @@ jobs: contents: none runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index e54e83e7bce0..896b9106d83b 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -19,7 +19,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'skip-sims')" steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -37,7 +37,7 @@ jobs: timeout-minutes: 60 steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -54,7 +54,7 @@ jobs: needs: [build] steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -72,7 +72,7 @@ jobs: timeout-minutes: 60 steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 20630a137610..4df554bf371a 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-pr-message: "This pull request has been automatically marked as stale because it has not had diff --git a/.github/workflows/starship-tests.yml b/.github/workflows/starship-tests.yml index 0b1587a528b6..9533aaba0f9a 100644 --- a/.github/workflows/starship-tests.yml +++ b/.github/workflows/starship-tests.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 45 steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddbf1b6a00a0..0aa767ef7804 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -52,7 +52,7 @@ jobs: part: ["00", "01", "02", "03"] steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -86,7 +86,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -117,7 +117,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -195,7 +195,7 @@ jobs: timeout-minutes: 15 steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -225,7 +225,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -258,7 +258,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -289,7 +289,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true @@ -320,7 +320,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true @@ -349,7 +349,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true @@ -380,7 +380,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true @@ -411,7 +411,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -447,7 +447,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -478,7 +478,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true @@ -509,7 +509,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -540,7 +540,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -571,7 +571,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -604,7 +604,7 @@ jobs: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true @@ -635,7 +635,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.20" check-latest: true @@ -673,7 +673,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -704,7 +704,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -735,7 +735,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -766,7 +766,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -797,7 +797,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -828,7 +828,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -859,7 +859,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -890,7 +890,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -920,7 +920,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -950,7 +950,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -980,7 +980,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -1010,7 +1010,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -1041,7 +1041,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -1072,7 +1072,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -1103,7 +1103,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -1134,7 +1134,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -1165,7 +1165,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true @@ -1196,7 +1196,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21" check-latest: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bcebf869eee..9be34195299a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,39 +45,39 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (client) [#18101](https://github.com/cosmos/cosmos-sdk/pull/18101) Add a `keyring-default-keyname` in `client.toml` for specifying a default key name, and skip the need to use the `--from` flag when signing transactions. * (tests) [#17868](https://github.com/cosmos/cosmos-sdk/pull/17868) Added helper method `SubmitTestTx` in testutil to broadcast test txns to test e2e tests. * (x/protocolpool) [#17657](https://github.com/cosmos/cosmos-sdk/pull/17657) Create a new `x/protocolpool` module that is responsible for handling community pool funds. This module is split out into a new module from x/distribution. -* (client/keys) [#17639](https://github.com/cosmos/cosmos-sdk/pull/17639) Allows using and saving public keys encoded as base64 -* (client) [#17513](https://github.com/cosmos/cosmos-sdk/pull/17513) Allow overwritting `client.toml`. Use `client.CreateClientConfig` in place of `client.ReadFromClientConfig` and provide a custom template and a custom config. +* (client) [#17513](https://github.com/cosmos/cosmos-sdk/pull/17513) Allow overwriting `client.toml`. Use `client.CreateClientConfig` in place of `client.ReadFromClientConfig` and provide a custom template and a custom config. * (x/bank) [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) Introduce a new message type, `MsgBurn`, to burn coins. -* (server) [#17094](https://github.com/cosmos/cosmos-sdk/pull/17094) Add duration `shutdown-grace` for resource clean up (closing database handles) before exit. * (x/auth/vesting) [#17810](https://github.com/cosmos/cosmos-sdk/pull/17810) Add the ability to specify a start time for continuous vesting accounts. * (runtime) [#18475](https://github.com/cosmos/cosmos-sdk/pull/18475) Adds an implementation for core.branch.Service. -* (server) [#18478](https://github.com/cosmos/cosmos-sdk/pull/18478) CMD flag to disable colored logs. * (baseapp) [#18499](https://github.com/cosmos/cosmos-sdk/pull/18499) Add `MsgRouter` response type from message name function. ### Improvements +* (x/gov) [#18707](https://github.com/cosmos/cosmos-sdk/pull/18707) Improve genesis validation. +* (x/bank) [#18636](https://github.com/cosmos/cosmos-sdk/pull/18636) `SendCoinsFromModuleToAccount`, `SendCoinsFromModuleToModule`, `SendCoinsFromAccountToModule`, `DelegateCoinsFromAccountToModule`, `UndelegateCoinsFromModuleToAccount`, `MintCoins` and `BurnCoins` methods now returns an error instead of panicking if any module accounts does not exist or unauthorized. +* (x/distribution) [#18636](https://github.com/cosmos/cosmos-sdk/pull/18636) `CalculateDelegationRewards` and `DelegationTotalRewards` methods no longer panics on any sanity checks and instead returns appropriate errors. +* (x/slashing) [#18636](https://github.com/cosmos/cosmos-sdk/pull/18636) `JailUntil` and `Tombstone` methods no longer panics if the signing info does not exist for the validator but instead returns error. +* (x/staking) [#18636](https://github.com/cosmos/cosmos-sdk/pull/18636) `IterateBondedValidatorsByPower`, `GetDelegatorBonded`, `Delegate`, `Unbond`, `Slash`, `Jail`, `SlashRedelegation`, `ApplyAndReturnValidatorSetUpdates` methods no longer panics on any kind of errors but instead returns appropriate errors. + * Usage of `Must...` kind of functions are avoided in keeper methods. +* (client/keys) [#18687](https://github.com/cosmos/cosmos-sdk/pull/18687) Improve ` keys mnemonic` by displaying mnemonic discreetly on an alternate screen and adding `--indiscreet` option to disable it. +* (client/keys) [#18684](https://github.com/cosmos/cosmos-sdk/pull/18684) Improve ` keys export` by displaying unarmored hex private key discreetly on an alternate screen and adding `--indiscreet` option to disable it. +* (client/keys) [#18663](https://github.com/cosmos/cosmos-sdk/pull/18663) Improve ` keys add` by displaying mnemonic discreetly on an alternate screen and adding `--indiscreet` option to disable it. * (types) [#18440](https://github.com/cosmos/cosmos-sdk/pull/18440) Add `AmountOfNoValidation` to `sdk.DecCoins`. -* (x/gov) [#18025](https://github.com/cosmos/cosmos-sdk/pull/18025) Improve ` q gov proposer` by querying directly a proposal instead of tx events. It is an alias of `q gov proposal` as the proposer is a field of the proposal. * (client) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) Add `client.Context{}.WithAddressCodec`, `WithValidatorAddressCodec`, `WithConsensusAddressCodec` to provide address codecs to the client context. See the [UPGRADING.md](./UPGRADING.md) for more details. * (crypto/keyring) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) Simplify keyring interfaces to use `[]byte` instead of `sdk.Address` for addresses. * (all) [#16537](https://github.com/cosmos/cosmos-sdk/pull/16537) Properly propagated `fmt.Errorf` errors and using `errors.New` where appropriate. * (rpc) [#17470](https://github.com/cosmos/cosmos-sdk/pull/17470) Avoid open 0.0.0.0 to public by default and add `listen-ip-address` argument for `testnet init-files` cmd. * (types) [#17670](https://github.com/cosmos/cosmos-sdk/pull/17670) Use `ctx.CometInfo` in place of `ctx.VoteInfos` * [#17733](https://github.com/cosmos/cosmos-sdk/pull/17733) Ensure `buf export` exports all proto dependencies -* (version) [#18063](https://github.com/cosmos/cosmos-sdk/pull/18063) Include additional information in the Info struct. This change enhances the Info struct by adding support for additional information through the ExtraInfo field +* (crypto/keys) [#18026](https://github.com/cosmos/cosmos-sdk/pull/18026) Made public key generation constant time on `secp256k1` * (crypto | x/auth) [#14372](https://github.com/cosmos/cosmos-sdk/pull/18194) Key checks on signatures antehandle. -* (codec/unknownproto)[#18541](https://github.com/cosmos/cosmos-sdk/pull/18541) Remove the use of "protoc-gen-gogo/descriptor" in favour of using the official protobuf descriptorpb types inside unknownproto. * (staking) [#18506](https://github.com/cosmos/cosmos-sdk/pull/18506) Detect the length of the ed25519 pubkey in CreateValidator to prevent panic. * (types) [#18372](https://github.com/cosmos/cosmos-sdk/pull/18372) Removed global configuration for coin type and purpose. Setters and getters should be removed and access directly to defined types. ### Bug Fixes * (client) [#18622](https://github.com/cosmos/cosmos-sdk/pull/18622) Fixed a potential under/overflow from `uint64->int64` when computing gas fees as a LegacyDec. -* (client/keys) [#18562](https://github.com/cosmos/cosmos-sdk/pull/18562) `keys delete` won't terminate when a key is not found -* (server) [#18537](https://github.com/cosmos/cosmos-sdk/pull/18537) Fix panic when defining minimum gas config as `100stake;100uatom`. Use a `,` delimiter instead of `;`. Fixes the server config getter to use the correct delimiter. -* [#18531](https://github.com/cosmos/cosmos-sdk/pull/18531) Baseapp's `GetConsensusParams` returns an empty struct instead of panicking if no params are found. -* (client/tx) [#18472](https://github.com/cosmos/cosmos-sdk/pull/18472) Utilizes the correct Pubkey when simulating a transaction. -* (baseapp) [#18486](https://github.com/cosmos/cosmos-sdk/pull/18486) Fixed FinalizeBlock calls not being passed to ABCIListeners +* (client/keys) [#18562](https://github.com/cosmos/cosmos-sdk/pull/18562) `keys delete` won't terminate when a key is not found. * (baseapp) [#18383](https://github.com/cosmos/cosmos-sdk/pull/18383) Fixed a data race inside BaseApp.getContext, found by end-to-end (e2e) tests. * (client/server) [#18345](https://github.com/cosmos/cosmos-sdk/pull/18345) Consistently set viper prefix in client and server. It defaults for the binary name for both client and server. * (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test. @@ -154,7 +154,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (types) [#17348](https://github.com/cosmos/cosmos-sdk/pull/17348) Remove the `WrapServiceResult` function. * The `*sdk.Result` returned by the msg server router will not contain the `.Data` field. * (x/staking) [#17335](https://github.com/cosmos/cosmos-sdk/pull/17335) Remove usage of `"cosmossdk.io/x/staking/types".Infraction_*` in favour of `"cosmossdk.io/api/cosmos/staking/v1beta1".Infraction_` in order to remove dependency between modules on staking -* (x/gov) [#17496](https://github.com/cosmos/cosmos-sdk/pull/17469) in `x/gov/types/v1beta1/vote.go` `NewVote` was removed, constructing the struct is required for this type * (types) [#17426](https://github.com/cosmos/cosmos-sdk/pull/17426) `NewContext` does not take a `cmtproto.Header{}` any longer. * `WithChainID` / `WithBlockHeight` / `WithBlockHeader` must be used to set values on the context * (x/bank) [#17569](https://github.com/cosmos/cosmos-sdk/pull/17569) `BurnCoins` takes an address instead of a module name @@ -164,7 +163,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/staking) [#17655](https://github.com/cosmos/cosmos-sdk/pull/17655) `QueryHistoricalInfo` was adjusted to return `HistoricalRecord` and marked `Hist` as deprecated. * (types) [#17885](https://github.com/cosmos/cosmos-sdk/pull/17885) `InitGenesis` & `ExportGenesis` now take `context.Context` instead of `sdk.Context` * (x/auth) [#17985](https://github.com/cosmos/cosmos-sdk/pull/17985) Remove `StdTxConfig` - * Remove depreacted `MakeTestingEncodingParams` from `simapp/params` + * Remove deprecated `MakeTestingEncodingParams` from `simapp/params` * (x/group) [#17937](https://github.com/cosmos/cosmos-sdk/pull/17937) Groups module was moved to its own go.mod `cosmossdk.io/x/group` * (x/gov) [#18197](https://github.com/cosmos/cosmos-sdk/pull/18197) Gov module was moved to its own go.mod `cosmossdk.io/x/gov` * (x/distribution) [#18199](https://github.com/cosmos/cosmos-sdk/pull/18199) Distribution module was moved to its own go.mod `cosmossdk.io/x/distribution` @@ -187,6 +186,32 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/upgrade) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) Upgrade module no longer stores the app version but gets and sets the app version stored in the `ParamStore` of baseapp. * (x/staking) [#17655](https://github.com/cosmos/cosmos-sdk/pull/17655) `HistoricalInfo` was replaced with `HistoricalRecord`, it removes the validator set and comet header and only keep what is needed for IBC. +## [v0.50.2](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.2) - 2023-12-11 + +### Features + +* (debug) [#18219](https://github.com/cosmos/cosmos-sdk/pull/18219) Add debug commands for application codec types. +* (client/keys) [#17639](https://github.com/cosmos/cosmos-sdk/pull/17639) Allows using and saving public keys encoded as base64. +* (server) [#17094](https://github.com/cosmos/cosmos-sdk/pull/17094) Add a `shutdown-grace` flag for waiting a given time before exit. + +### Improvements + +* (telemetry) [#18646](https://github.com/cosmos/cosmos-sdk/pull/18646) Enable statsd and dogstatsd telemetry sinks. +* (server) [#18478](https://github.com/cosmos/cosmos-sdk/pull/18478) Add command flag to disable colored logs. +* (x/gov) [#18025](https://github.com/cosmos/cosmos-sdk/pull/18025) Improve ` q gov proposer` by querying directly a proposal instead of tx events. It is an alias of `q gov proposal` as the proposer is a field of the proposal. +* (version) [#18063](https://github.com/cosmos/cosmos-sdk/pull/18063) Allow to define extra info to be displayed in ` version --long` command. +* (codec/unknownproto)[#18541](https://github.com/cosmos/cosmos-sdk/pull/18541) Remove the use of "protoc-gen-gogo/descriptor" in favour of using the official protobuf descriptorpb types inside unknownproto. + +### Bug Fixes + +* (x/auth) [#18564](https://github.com/cosmos/cosmos-sdk/pull/18564) Fix total fees calculation when batch signing. +* (server) [#18537](https://github.com/cosmos/cosmos-sdk/pull/18537) Fix panic when defining minimum gas config as `100stake;100uatom`. Use a `,` delimiter instead of `;`. Fixes the server config getter to use the correct delimiter. +* [#18531](https://github.com/cosmos/cosmos-sdk/pull/18531) Baseapp's `GetConsensusParams` returns an empty struct instead of panicking if no params are found. +* (client/tx) [#18472](https://github.com/cosmos/cosmos-sdk/pull/18472) Utilizes the correct Pubkey when simulating a transaction. +* (baseapp) [#18486](https://github.com/cosmos/cosmos-sdk/pull/18486) Fixed FinalizeBlock calls not being passed to ABCIListeners. +* (baseapp) [#18627](https://github.com/cosmos/cosmos-sdk/pull/18627) Post handlers are run on non successful transaction executions too. +* (baseapp) [#18654](https://github.com/cosmos/cosmos-sdk/pull/18654) Fixes an issue in which `gogoproto.Merge` does not work with gogoproto messages with custom types. + ## [v0.50.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.1) - 2023-11-07 > v0.50.0 has been retracted due to a mistake in tagging the release. Please use v0.50.1 instead. @@ -207,7 +232,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (baseapp) [#16239](https://github.com/cosmos/cosmos-sdk/pull/16239) Add Gas Limits to allow node operators to resource bound queries. * (cli) [#16209](https://github.com/cosmos/cosmos-sdk/pull/16209) Make `StartCmd` more customizable. * (types/simulation) [#16074](https://github.com/cosmos/cosmos-sdk/pull/16074) Add generic SimulationStoreDecoder for modules using collections. -* (genutil) [#16046](https://github.com/cosmos/cosmos-sdk/pull/16046) Add "module-name" flag to genutil `add-genesis-account` to enable intializing module accounts at genesis.* [#15970](https://github.com/cosmos/cosmos-sdk/pull/15970) Enable SIGN_MODE_TEXTUAL. +* (genutil) [#16046](https://github.com/cosmos/cosmos-sdk/pull/16046) Add "module-name" flag to genutil `add-genesis-account` to enable initializing module accounts at genesis.* [#15970](https://github.com/cosmos/cosmos-sdk/pull/15970) Enable SIGN_MODE_TEXTUAL. * (types) [#15958](https://github.com/cosmos/cosmos-sdk/pull/15958) Add `module.NewBasicManagerFromManager` for creating a basic module manager from a module manager. * (types/module) [#15829](https://github.com/cosmos/cosmos-sdk/pull/15829) Add new endblocker interface to handle valset updates. * (runtime) [#15818](https://github.com/cosmos/cosmos-sdk/pull/15818) Provide logger through `depinject` instead of appBuilder. @@ -259,7 +284,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (cli) [#16206](https://github.com/cosmos/cosmos-sdk/pull/16206) Make ABCI handshake profileable. * (types) [#16076](https://github.com/cosmos/cosmos-sdk/pull/16076) Optimize `ChainAnteDecorators`/`ChainPostDecorators` to instantiate the functions once instead of on every invocation of the returned `AnteHandler`/`PostHandler`. * (server) [#16071](https://github.com/cosmos/cosmos-sdk/pull/16071) When `mempool.max-txs` is set to a negative value, use a no-op mempool (effectively disable the app mempool). -* (types/query) [#16041](https://github.com/cosmos/cosmos-sdk/pull/16041) Change pagination max limit to a variable in order to be modifed by application devs. +* (types/query) [#16041](https://github.com/cosmos/cosmos-sdk/pull/16041) Change pagination max limit to a variable in order to be modified by application devs. * (simapp) [#15958](https://github.com/cosmos/cosmos-sdk/pull/15958) Refactor SimApp for removing the global basic manager. * (all modules) [#15901](https://github.com/cosmos/cosmos-sdk/issues/15901) All core Cosmos SDK modules query commands have migrated to [AutoCLI](https://docs.cosmos.network/main/core/autocli), ensuring parity between gRPC and CLI queries. * (x/auth) [#15867](https://github.com/cosmos/cosmos-sdk/pull/15867) Support better logging for signature verification failure. @@ -286,7 +311,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (store) [#14439](https://github.com/cosmos/cosmos-sdk/pull/14439) Remove global metric gatherer from store. * By default store has a no op metric gatherer, the application developer must set another metric gatherer or us the provided one in `store/metrics`. * (store) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store. -* (baseapp) [#14417](https://github.com/cosmos/cosmos-sdk/pull/14417) The store pacakge no longer has a dependency on baseapp. +* (baseapp) [#14417](https://github.com/cosmos/cosmos-sdk/pull/14417) The store package no longer has a dependency on baseapp. * (module) [#14415](https://github.com/cosmos/cosmos-sdk/pull/14415) Loosen assertions in SetOrderBeginBlockers() and SetOrderEndBlockers(). * (store) [#14410](https://github.com/cosmos/cosmos-sdk/pull/14410) `rootmulti.Store.loadVersion` has validation to check if all the module stores' height is correct, it will error if any module store has incorrect height. * [#14406](https://github.com/cosmos/cosmos-sdk/issues/14406) Migrate usage of `types/store.go` to `store/types/..`. @@ -336,7 +361,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/auth) [#16650](https://github.com/cosmos/cosmos-sdk/pull/16650) The *cli testutil* `QueryAccountExec` has been removed. Use the gRPC or REST query instead. * (x/auth) [#16621](https://github.com/cosmos/cosmos-sdk/pull/16621) Pass address codec to auth new keeper constructor. * (x/auth) [#16423](https://github.com/cosmos/cosmos-sdk/pull/16423) `helpers.AddGenesisAccount` has been moved to `x/genutil` to remove the cyclic dependency between `x/auth` and `x/genutil`. -* (baseapp) [#16342](https://github.com/cosmos/cosmos-sdk/pull/16342) NewContext was renamed to NewContextLegacy. The replacement (NewContext) now does not take a header, instead you should set the header via `WithHeaderInfo` or `WithBlockHeight`. Note that `WithBlockHeight` will soon be depreacted and its recommneded to use `WithHeaderInfo`. +* (baseapp) [#16342](https://github.com/cosmos/cosmos-sdk/pull/16342) NewContext was renamed to NewContextLegacy. The replacement (NewContext) now does not take a header, instead you should set the header via `WithHeaderInfo` or `WithBlockHeight`. Note that `WithBlockHeight` will soon be deprecated and its recommended to use `WithHeaderInfo`. * (x/mint) [#16329](https://github.com/cosmos/cosmos-sdk/pull/16329) Use collections for state management: * Removed: keeper `GetParams`, `SetParams`, `GetMinter`, `SetMinter`. * (x/crisis) [#16328](https://github.com/cosmos/cosmos-sdk/pull/16328) Use collections for state management: @@ -369,7 +394,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/gov) [#16127](https://github.com/cosmos/cosmos-sdk/pull/16127) Use collections for deposit state management: * The following methods are removed from the gov keeper: `GetDeposit`, `GetAllDeposits`, `IterateAllDeposits`. * The following functions are removed from the gov types: `DepositKey`, `DepositsKey`. -* (x/gov) [#16118](https://github.com/cosmos/cosmos-sdk/pull/16118/) Use collections for constituion and params state management. +* (x/gov) [#16118](https://github.com/cosmos/cosmos-sdk/pull/16118/) Use collections for constitution and params state management. * (x/gov) [#16106](https://github.com/cosmos/cosmos-sdk/pull/16106) Remove gRPC query methods from gov keeper. * (x/*all*) [#16052](https://github.com/cosmos/cosmos-sdk/pull/16062) `GetSignBytes` implementations on messages and global legacy amino codec definitions have been removed from all modules. * (sims) [#16052](https://github.com/cosmos/cosmos-sdk/pull/16062) `GetOrGenerate` no longer requires a codec argument is now 4-arity instead of 5-arity. @@ -406,7 +431,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * `MsgSendExec` test helper function now takes a address.Codec * (x/auth) [#15520](https://github.com/cosmos/cosmos-sdk/pull/15520) `NewAccountKeeper` now takes a `KVStoreService` instead of a `StoreKey` and methods in the `Keeper` now take a `context.Context` instead of a `sdk.Context`. * (baseapp) [#15519](https://github.com/cosmos/cosmos-sdk/pull/15519/files) `runTxMode`s were renamed to `execMode`. `ModeDeliver` as changed to `ModeFinalize` and a new `ModeVoteExtension` was added for vote extensions. -* (baseapp) [#15519](https://github.com/cosmos/cosmos-sdk/pull/15519/files) Writing of state to the multistore was moved to `FinalizeBlock`. `Commit` still handles the commiting values to disk. +* (baseapp) [#15519](https://github.com/cosmos/cosmos-sdk/pull/15519/files) Writing of state to the multistore was moved to `FinalizeBlock`. `Commit` still handles the committing values to disk. * (baseapp) [#15519](https://github.com/cosmos/cosmos-sdk/pull/15519/files) Calls to BeginBlock and EndBlock have been replaced with core api beginblock & endblock. * (baseapp) [#15519](https://github.com/cosmos/cosmos-sdk/pull/15519/files) BeginBlock and EndBlock are now internal to baseapp. For testing, user must call `FinalizeBlock`. BeginBlock and EndBlock calls are internal to Baseapp. * (baseapp) [#15519](https://github.com/cosmos/cosmos-sdk/pull/15519/files) All calls to ABCI methods now accept a pointer of the abci request and response types @@ -481,7 +506,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * `--count-total` -> `--page-count-total` * (cli) [#17184](https://github.com/cosmos/cosmos-sdk/pull/17184) All json keys returned by the `status` command are now snake case instead of pascal case. * (server) [#17177](https://github.com/cosmos/cosmos-sdk/pull/17177) Remove `iavl-lazy-loading` configuration. -* (x/gov) [#16987](https://github.com/cosmos/cosmos-sdk/pull/16987) In ` query gov proposals` the proposal status flag have renamed from `--status` to `--proposal-status`. Additonally, that flags now uses the ENUM values: `PROPOSAL_STATUS_DEPOSIT_PERIOD`, `PROPOSAL_STATUS_VOTING_PERIOD`, `PROPOSAL_STATUS_PASSED`, `PROPOSAL_STATUS_REJECTED`, `PROPOSAL_STATUS_FAILED`. +* (x/gov) [#16987](https://github.com/cosmos/cosmos-sdk/pull/16987) In ` query gov proposals` the proposal status flag have renamed from `--status` to `--proposal-status`. Additionally, that flags now uses the ENUM values: `PROPOSAL_STATUS_DEPOSIT_PERIOD`, `PROPOSAL_STATUS_VOTING_PERIOD`, `PROPOSAL_STATUS_PASSED`, `PROPOSAL_STATUS_REJECTED`, `PROPOSAL_STATUS_FAILED`. * (x/bank) [#16899](https://github.com/cosmos/cosmos-sdk/pull/16899) With the migration to AutoCLI some bank commands have been split in two: * Use `total-supply` (or `total`) for querying the total supply and `total-supply-of` for querying the supply of a specific denom. * Use `denoms-metadata` for querying all denom metadata and `denom-metadata` for querying a specific denom metadata. @@ -591,7 +616,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* (cli) [#16856](https://github.com/cosmos/cosmos-sdk/pull/16856) Improve `simd prune` UX by using the app default home directory and set pruning method as first variable argument (defaults to default). `pruning.PruningCmd` rest unchanged for API compability, use `pruning.Cmd` instead. +* (cli) [#16856](https://github.com/cosmos/cosmos-sdk/pull/16856) Improve `simd prune` UX by using the app default home directory and set pruning method as first variable argument (defaults to default). `pruning.PruningCmd` rest unchanged for API compatibility, use `pruning.Cmd` instead. * (testutil) [#16704](https://github.com/cosmos/cosmos-sdk/pull/16704) Make app config configurator for testing configurable with external modules. * (deps) [#16565](https://github.com/cosmos/cosmos-sdk/pull/16565) Bump CometBFT to [v0.37.2](https://github.com/cometbft/cometbft/blob/v0.37.2/CHANGELOG.md). @@ -600,7 +625,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/auth) [#16994](https://github.com/cosmos/cosmos-sdk/pull/16994) Fix regression where querying transactions events with `<=` or `>=` would not work. * (server) [#16827](https://github.com/cosmos/cosmos-sdk/pull/16827) Properly use `--trace` flag (before it was setting the trace level instead of displaying the stacktraces). * (x/auth) [#16554](https://github.com/cosmos/cosmos-sdk/pull/16554) `ModuleAccount.Validate` now reports a nil `.BaseAccount` instead of panicking. -* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propogate snapshotter failures to the caller, (it would create an empty snapshot silently before). +* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propagate snapshotter failures to the caller, (it would create an empty snapshot silently before). * (x/slashing) [#16784](https://github.com/cosmos/cosmos-sdk/pull/16784) Emit event with the correct reason in `SlashWithInfractionReason`. ## [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3) - 2023-06-08 @@ -687,12 +712,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/gov) [#15151](https://github.com/cosmos/cosmos-sdk/pull/15151) Add `burn_vote_quorum`, `burn_proposal_deposit_prevote` and `burn_vote_veto` params to allow applications to decide if they would like to burn deposits * (client) [#14509](https://github.com/cosmos/cosmos-sdk/pull/#14509) Added `AddKeyringFlags` function. * (x/bank) [#14045](https://github.com/cosmos/cosmos-sdk/pull/14045) Add CLI command `spendable-balances`, which also accepts the flag `--denom`. -* (x/slashing, x/staking) [#14363](https://github.com/cosmos/cosmos-sdk/pull/14363) Add the infraction a validator commited type as an argument to a `SlashWithInfractionReason` keeper method. +* (x/slashing, x/staking) [#14363](https://github.com/cosmos/cosmos-sdk/pull/14363) Add the infraction a validator committed type as an argument to a `SlashWithInfractionReason` keeper method. * (client) [#14051](https://github.com/cosmos/cosmos-sdk/pull/14051) Add `--grpc` client option. * (x/genutil) [#14149](https://github.com/cosmos/cosmos-sdk/pull/14149) Add `genutilcli.GenesisCoreCommand` command, which contains all genesis-related sub-commands. * (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Add new proto field `hash` of type `string` to `QueryEvidenceRequest` which helps to decode the hash properly while using query API. * (core) [#13306](https://github.com/cosmos/cosmos-sdk/pull/13306) Add a `FormatCoins` function to in `core/coins` to format sdk Coins following the Value Renderers spec. -* (math) [#13306](https://github.com/cosmos/cosmos-sdk/pull/13306) Add `FormatInt` and `FormatDec` functiosn in `math` to format integers and decimals following the Value Renderers spec. +* (math) [#13306](https://github.com/cosmos/cosmos-sdk/pull/13306) Add `FormatInt` and `FormatDec` functions in `math` to format integers and decimals following the Value Renderers spec. * (x/staking) [#13122](https://github.com/cosmos/cosmos-sdk/pull/13122) Add `UnbondingCanComplete` and `PutUnbondingOnHold` to `x/staking` module. * [#13437](https://github.com/cosmos/cosmos-sdk/pull/13437) Add new flag `--modules-to-export` in `simd export` command to export only selected modules. * [#13298](https://github.com/cosmos/cosmos-sdk/pull/13298) Add `AddGenesisAccount` helper func in x/auth module which helps adding accounts to genesis state. @@ -936,14 +961,14 @@ EOL notice. This is the last release of the `v0.46.x` line. Per this version, th ### Improvements -* (cli) [#16856](https://github.com/cosmos/cosmos-sdk/pull/16856) Improve `simd prune` UX by using the app default home directory and set pruning method as first variable argument (defaults to default). `pruning.PruningCmd` rest unchanged for API compability, use `pruning.Cmd` instead. +* (cli) [#16856](https://github.com/cosmos/cosmos-sdk/pull/16856) Improve `simd prune` UX by using the app default home directory and set pruning method as first variable argument (defaults to default). `pruning.PruningCmd` rest unchanged for API compatibility, use `pruning.Cmd` instead. * (deps) [#16553](https://github.com/cosmos/cosmos-sdk/pull/16553) Bump CometBFT to [v0.34.29](https://github.com/cometbft/cometbft/blob/v0.34.29/CHANGELOG.md#v03429). ### Bug Fixes * (x/auth) [#16994](https://github.com/cosmos/cosmos-sdk/pull/16994) Fix regression where querying transactions events with `<=` or `>=` would not work. * (x/auth) [#16554](https://github.com/cosmos/cosmos-sdk/pull/16554) `ModuleAccount.Validate` now reports a nil `.BaseAccount` instead of panicking. -* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propogate snapshotter failures to the caller, (it would create an empty snapshot silently before). +* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propagate snapshotter failures to the caller, (it would create an empty snapshot silently before). * (types) [#15433](https://github.com/cosmos/cosmos-sdk/pull/15433) Allow disabling of account address caches (for printing bech32 account addresses). ## [v0.46.13](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.13) - 2023-06-08 @@ -1008,7 +1033,7 @@ EOL notice. This is the last release of the `v0.46.x` line. Per this version, th * (deps) [#14846](https://github.com/cosmos/cosmos-sdk/pull/14846) Bump btcd. * (deps) Bump Tendermint version to [v0.34.26](https://github.com/informalsystems/tendermint/releases/tag/v0.34.26). * (store/cache) [#14189](https://github.com/cosmos/cosmos-sdk/pull/14189) Add config `iavl-lazy-loading` to enable lazy loading of iavl store, to improve start up time of archive nodes, add method `SetLazyLoading` to `CommitMultiStore` interface. - * A new field has been added to the app.toml. This alllows nodes with larger databases to startup quicker + * A new field has been added to the app.toml. This allows nodes with larger databases to startup quicker ```toml # IAVLLazyLoading enable/disable the lazy loading of iavl store. @@ -1600,7 +1625,7 @@ replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8 ### Bug Fixes -* [#13588](https://github.com/cosmos/cosmos-sdk/pull/13588) Fix regression in distrubtion.WithdrawDelegationRewards when rewards are zero. +* [#13588](https://github.com/cosmos/cosmos-sdk/pull/13588) Fix regression in distribution.WithdrawDelegationRewards when rewards are zero. * [#13564](https://github.com/cosmos/cosmos-sdk/pull/13564) - Fix `make proto-gen`. * (server) [#13610](https://github.com/cosmos/cosmos-sdk/pull/13610) Read the pruning-keep-every field again. @@ -1628,7 +1653,7 @@ replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8 * [#13323](https://github.com/cosmos/cosmos-sdk/pull/13323) Ensure `withdraw_rewards` rewards are emitted from all actions that result in rewards being withdrawn. * [#13321](https://github.com/cosmos/cosmos-sdk/pull/13321) Add flag to disable fast node migration and usage. * (store) [#13326](https://github.com/cosmos/cosmos-sdk/pull/13326) Implementation of ADR-038 file StreamingService, backport #8664. -* (store) [#13540](https://github.com/cosmos/cosmos-sdk/pull/13540) Default fastnode migration to false to prevent suprises. Operators must enable it, unless they have it enabled already. +* (store) [#13540](https://github.com/cosmos/cosmos-sdk/pull/13540) Default fastnode migration to false to prevent surprises. Operators must enable it, unless they have it enabled already. ### API Breaking Changes @@ -2339,7 +2364,7 @@ he Cosmos Hub) should not use this release or any release in the v0.41.x series. * (x/ibc) [#8458](https://github.com/cosmos/cosmos-sdk/pull/8458) Add `packet_connection` attribute to ibc events to enable relayer filtering * [#8396](https://github.com/cosmos/cosmos-sdk/pull/8396) Add support for ARM platform -* (x/bank) [#8479](https://github.com/cosmos/cosmos-sdk/pull/8479) Aditional client denom metadata validation for `base` and `display` denoms. +* (x/bank) [#8479](https://github.com/cosmos/cosmos-sdk/pull/8479) Additional client denom metadata validation for `base` and `display` denoms. * (codec/types) [#8605](https://github.com/cosmos/cosmos-sdk/pull/8605) Avoid unnecessary allocations for NewAnyWithCustomTypeURL on error. ## [v0.41.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.41.0) - 2021-01-26 @@ -2462,7 +2487,7 @@ sure you are aware of any relevant breaking changes. The `PruningOptions` type now only includes fields `KeepEvery` and `SnapshotEvery`, where `KeepEvery` determines which committed heights are flushed to disk and `SnapshotEvery` determines which of these heights are kept after pruning. The `IsValid` method should be called whenever using these options. Methods - `SnapshotVersion` and `FlushVersion` accept a version arugment and determine if the version should be + `SnapshotVersion` and `FlushVersion` accept a version argument and determine if the version should be flushed to disk or kept as a snapshot. Note, `KeepRecent` is automatically inferred from the options and provided directly the IAVL store. * (types) [#5533](https://github.com/cosmos/cosmos-sdk/pull/5533) Refactored `AppModuleBasic` and `AppModuleGenesis` @@ -2740,7 +2765,7 @@ sure you are aware of any relevant breaking changes. * (types) [#5581](https://github.com/cosmos/cosmos-sdk/pull/5581) Add convenience functions {,Must}Bech32ifyAddressBytes. * (types/module) [#5724](https://github.com/cosmos/cosmos-sdk/issues/5724) The `types/module` package does no longer depend on `x/simulation`. * (types) [#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) IBC additions: - * `Coin` denomination max lenght has been increased to 32. + * `Coin` denomination max length has been increased to 32. * Added `CapabilityKey` alias for `StoreKey` to match IBC spec. * (types/rest) [#5900](https://github.com/cosmos/cosmos-sdk/pull/5900) Add Check\*Error function family to spare developers from replicating tons of boilerplate code. * (types) [#6128](https://github.com/cosmos/cosmos-sdk/pull/6137) Add `String()` method to `GasMeter`. diff --git a/CODING_GUIDELINES.md b/CODING_GUIDELINES.md index 8793b5e42b16..ca8ba3aa9956 100644 --- a/CODING_GUIDELINES.md +++ b/CODING_GUIDELINES.md @@ -102,7 +102,7 @@ When testing a function under a variety of different inputs, we prefer to use [table driven tests](https://github.com/golang/go/wiki/TableDrivenTests). Table driven test error messages should follow the following format `, tc #, i #`. -`` is an optional short description of whats failing, `tc` is the +`` is an optional short description of what's failing, `tc` is the index within the test case table that is failing, and `i` is when there is a loop, exactly which iteration of the loop failed. The idea is you should be able to see the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d3a56e541ae4..c336903968b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,11 +47,15 @@ contributors, the general procedure for contributing has been established: to begin work. 5. To submit your work as a contribution to the repository follow standard GitHub best practices. See [pull request guideline](#pull-requests) below. -**Note:** For very small or blatantly obvious problems such as typos, you are +**Note:** For very small or blatantly obvious problems, you are not required to an open issue to submit a PR, but be aware that for more complex problems/features, if a PR is opened before an adequate design discussion has taken place in a GitHub issue, that PR runs a high likelihood of being rejected. +**Note 2:** At this time, we will not be accepting contributions that only fix spelling +or grammar errors in documentation, code or elsewhere. The repository has a nightly job that +spell checks all files and will automatically open PRs for any spelling errors. + ## Teams Dev Calls The Cosmos SDK has many stakeholders contributing and shaping the project. The Core SDK team is composed of Interchain GmbH and Regen Network Development developers. Any long-term contributors and additional maintainers from other projects are welcome. We use self-organizing principles to coordinate and collaborate across organizations in structured "EPIC" that focus on specific problem domains or architectural components of the Cosmos SDK. diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md index acf6db745794..35f1f21f4602 100644 --- a/RELEASE_PROCESS.md +++ b/RELEASE_PROCESS.md @@ -206,7 +206,7 @@ The **Stable Release Managers** evaluate and approve or reject updates and backp according to the [stable release policy](#stable-release-policy) and [release procedure](#major-release-procedure). Decisions are made by consensus. -Their responsibilites include: +Their responsibilities include: * Driving the Stable Release Exception process. * Approving/rejecting proposed changes to a stable release series. @@ -235,7 +235,7 @@ Note: The Cosmos SDK team is in an active process of limiting Go modules that de The Cosmos SDK team should strive to release modules that depend on the Cosmos SDK at the same time or soon after a major version Cosmos SDK itself. Those modules can be considered as part of the Cosmos SDK, but features and improvements are released at a different cadence. -* When a module is supposed to be used in an app (e.g `x/` modules), due to the dependency on the SDK, tagging a new version of a module must be done from a Cosmos SDK release branch. A compability matrix must be provided in the `README.md` of that module with the corresponding versions. +* When a module is supposed to be used in an app (e.g `x/` modules), due to the dependency on the SDK, tagging a new version of a module must be done from a Cosmos SDK release branch. A compatibility matrix must be provided in the `README.md` of that module with the corresponding versions. * Modules that import the SDK but do not need to be imported in an app (`e.g. cosmovisor`) must be released from the `main` branch and follow the process defined below. ### Modules that do not depend on the Cosmos SDK diff --git a/ROADMAP.md b/ROADMAP.md index 7ed72ae95ee4..4b731a6a0922 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -116,7 +116,7 @@ Issue: https://github.com/cosmos/iavl/issues/548 * Users should be able to pick between delayed execution and optimistic * RFC/ADR is merged * Implementation started. - * Progess: + * Progress: * On pause till ABCI 2.0 is merged ### Client UX @@ -159,14 +159,14 @@ Issue: https://github.com/cosmos/iavl/issues/548 * KvStoreService is being added to all modules * [ ] [Remove global bech32](https://github.com/cosmos/cosmos-sdk/issues/13140) * Objective: - * Depreacte global bech32 setting + * Deprecate global bech32 setting * Progress: * All modules except bank use the `address.Codec` * [ ] Make sdk.Msg only be `proto.message` * Objectives: * Reduce sdk.Msg to only be proto.message * Reduce boilerplate in `msgs.go` - * Progess: + * Progress: * [x] [Make ValidateBasic Optional](https://github.com/cosmos/cosmos-sdk/issues/15648) * [ ] [Make GetSigners be optional](https://github.com/cosmos/cosmos-sdk/issues/15677) * [ ] Remove GetsignBytes for legacy amino encoding diff --git a/UPGRADING.md b/UPGRADING.md index 62fc97d93420..5e52d8b56ba6 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -346,7 +346,7 @@ User manually wiring their chain need to add the logger argument when creating t #### Module Basics -Previously, the `ModuleBasics` was a global variable that was used to register all modules's `AppModuleBasic` implementation. +Previously, the `ModuleBasics` was a global variable that was used to register all modules' `AppModuleBasic` implementation. The global variable has been removed and the basic module manager can be now created from the module manager. This is automatically done for `depinject` / app v2 users, however for supplying different app module implementation, pass them via `depinject.Supply` in the main `AppConfig` (`app_config.go`): @@ -365,7 +365,7 @@ depinject.Supply( ) ``` -Users manually wiring their chain need to use the new `module.NewBasicManagerFromManager` function, after the module manager creation, and pass a `map[string]module.AppModuleBasic` as argument for optionally overridding some module's `AppModuleBasic`. +Users manually wiring their chain need to use the new `module.NewBasicManagerFromManager` function, after the module manager creation, and pass a `map[string]module.AppModuleBasic` as argument for optionally overriding some module's `AppModuleBasic`. #### AutoCLI @@ -493,7 +493,7 @@ To learn more see the [docs](https://docs.cosmos.network/main/learn/advanced/tra * Messages no longer need to implement the `LegacyMsg` interface and implementations of `GetSignBytes` can be deleted. Because of this change, global legacy Amino codec definitions and their registration in `init()` can safely be removed as well. -* The `AppModuleBasic` interface has been simplifed. Defining `GetTxCmd() *cobra.Command` and `GetQueryCmd() *cobra.Command` is no longer required. The module manager detects when module commands are defined. If AutoCLI is enabled, `EnhanceRootCommand()` will add the auto-generated commands to the root command, unless a custom module command is defined and register that one instead. +* The `AppModuleBasic` interface has been simplified. Defining `GetTxCmd() *cobra.Command` and `GetQueryCmd() *cobra.Command` is no longer required. The module manager detects when module commands are defined. If AutoCLI is enabled, `EnhanceRootCommand()` will add the auto-generated commands to the root command, unless a custom module command is defined and register that one instead. * The following modules' `Keeper` methods now take in a `context.Context` instead of `sdk.Context`. Any module that has an interfaces for them (like "expected keepers") will need to update and re-generate mocks if needed: @@ -800,7 +800,7 @@ In case a module does not follow the standard message path, (e.g. IBC), it is ad #### `x/params` The `params` module was deprecated since v0.46. The Cosmos SDK has migrated away from `x/params` for its own modules. -Cosmos SDK modules now store their parameters directly in its repective modules. +Cosmos SDK modules now store their parameters directly in its respective modules. The `params` module will be removed in `v0.50`, as mentioned [in v0.46 release](https://github.com/cosmos/cosmos-sdk/blob/v0.46.1/UPGRADING.md#xparams). It is strongly encouraged to migrate away from `x/params` before `v0.50`. When performing a chain migration, the params table must be initizalied manually. This was done in the modules keepers in previous versions. diff --git a/api/cosmos/accounts/v1/genesis.pulsar.go b/api/cosmos/accounts/v1/genesis.pulsar.go index ead7efaf846a..0dcbfa57eea6 100644 --- a/api/cosmos/accounts/v1/genesis.pulsar.go +++ b/api/cosmos/accounts/v1/genesis.pulsar.go @@ -554,62 +554,63 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_GenesisAccount_3_list)(nil) +var _ protoreflect.List = (*_GenesisAccount_4_list)(nil) -type _GenesisAccount_3_list struct { +type _GenesisAccount_4_list struct { list *[]*KVPair } -func (x *_GenesisAccount_3_list) Len() int { +func (x *_GenesisAccount_4_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_GenesisAccount_3_list) Get(i int) protoreflect.Value { +func (x *_GenesisAccount_4_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_GenesisAccount_3_list) Set(i int, value protoreflect.Value) { +func (x *_GenesisAccount_4_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*KVPair) (*x.list)[i] = concreteValue } -func (x *_GenesisAccount_3_list) Append(value protoreflect.Value) { +func (x *_GenesisAccount_4_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*KVPair) *x.list = append(*x.list, concreteValue) } -func (x *_GenesisAccount_3_list) AppendMutable() protoreflect.Value { +func (x *_GenesisAccount_4_list) AppendMutable() protoreflect.Value { v := new(KVPair) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_GenesisAccount_3_list) Truncate(n int) { +func (x *_GenesisAccount_4_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_GenesisAccount_3_list) NewElement() protoreflect.Value { +func (x *_GenesisAccount_4_list) NewElement() protoreflect.Value { v := new(KVPair) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_GenesisAccount_3_list) IsValid() bool { +func (x *_GenesisAccount_4_list) IsValid() bool { return x.list != nil } var ( - md_GenesisAccount protoreflect.MessageDescriptor - fd_GenesisAccount_address protoreflect.FieldDescriptor - fd_GenesisAccount_account_type protoreflect.FieldDescriptor - fd_GenesisAccount_state protoreflect.FieldDescriptor + md_GenesisAccount protoreflect.MessageDescriptor + fd_GenesisAccount_address protoreflect.FieldDescriptor + fd_GenesisAccount_account_type protoreflect.FieldDescriptor + fd_GenesisAccount_account_number protoreflect.FieldDescriptor + fd_GenesisAccount_state protoreflect.FieldDescriptor ) func init() { @@ -617,6 +618,7 @@ func init() { md_GenesisAccount = File_cosmos_accounts_v1_genesis_proto.Messages().ByName("GenesisAccount") fd_GenesisAccount_address = md_GenesisAccount.Fields().ByName("address") fd_GenesisAccount_account_type = md_GenesisAccount.Fields().ByName("account_type") + fd_GenesisAccount_account_number = md_GenesisAccount.Fields().ByName("account_number") fd_GenesisAccount_state = md_GenesisAccount.Fields().ByName("state") } @@ -697,8 +699,14 @@ func (x *fastReflection_GenesisAccount) Range(f func(protoreflect.FieldDescripto return } } + if x.AccountNumber != uint64(0) { + value := protoreflect.ValueOfUint64(x.AccountNumber) + if !f(fd_GenesisAccount_account_number, value) { + return + } + } if len(x.State) != 0 { - value := protoreflect.ValueOfList(&_GenesisAccount_3_list{list: &x.State}) + value := protoreflect.ValueOfList(&_GenesisAccount_4_list{list: &x.State}) if !f(fd_GenesisAccount_state, value) { return } @@ -722,6 +730,8 @@ func (x *fastReflection_GenesisAccount) Has(fd protoreflect.FieldDescriptor) boo return x.Address != "" case "cosmos.accounts.v1.GenesisAccount.account_type": return x.AccountType != "" + case "cosmos.accounts.v1.GenesisAccount.account_number": + return x.AccountNumber != uint64(0) case "cosmos.accounts.v1.GenesisAccount.state": return len(x.State) != 0 default: @@ -744,6 +754,8 @@ func (x *fastReflection_GenesisAccount) Clear(fd protoreflect.FieldDescriptor) { x.Address = "" case "cosmos.accounts.v1.GenesisAccount.account_type": x.AccountType = "" + case "cosmos.accounts.v1.GenesisAccount.account_number": + x.AccountNumber = uint64(0) case "cosmos.accounts.v1.GenesisAccount.state": x.State = nil default: @@ -768,11 +780,14 @@ func (x *fastReflection_GenesisAccount) Get(descriptor protoreflect.FieldDescrip case "cosmos.accounts.v1.GenesisAccount.account_type": value := x.AccountType return protoreflect.ValueOfString(value) + case "cosmos.accounts.v1.GenesisAccount.account_number": + value := x.AccountNumber + return protoreflect.ValueOfUint64(value) case "cosmos.accounts.v1.GenesisAccount.state": if len(x.State) == 0 { - return protoreflect.ValueOfList(&_GenesisAccount_3_list{}) + return protoreflect.ValueOfList(&_GenesisAccount_4_list{}) } - listValue := &_GenesisAccount_3_list{list: &x.State} + listValue := &_GenesisAccount_4_list{list: &x.State} return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { @@ -798,9 +813,11 @@ func (x *fastReflection_GenesisAccount) Set(fd protoreflect.FieldDescriptor, val x.Address = value.Interface().(string) case "cosmos.accounts.v1.GenesisAccount.account_type": x.AccountType = value.Interface().(string) + case "cosmos.accounts.v1.GenesisAccount.account_number": + x.AccountNumber = value.Uint() case "cosmos.accounts.v1.GenesisAccount.state": lv := value.List() - clv := lv.(*_GenesisAccount_3_list) + clv := lv.(*_GenesisAccount_4_list) x.State = *clv.list default: if fd.IsExtension() { @@ -826,12 +843,14 @@ func (x *fastReflection_GenesisAccount) Mutable(fd protoreflect.FieldDescriptor) if x.State == nil { x.State = []*KVPair{} } - value := &_GenesisAccount_3_list{list: &x.State} + value := &_GenesisAccount_4_list{list: &x.State} return protoreflect.ValueOfList(value) case "cosmos.accounts.v1.GenesisAccount.address": panic(fmt.Errorf("field address of message cosmos.accounts.v1.GenesisAccount is not mutable")) case "cosmos.accounts.v1.GenesisAccount.account_type": panic(fmt.Errorf("field account_type of message cosmos.accounts.v1.GenesisAccount is not mutable")) + case "cosmos.accounts.v1.GenesisAccount.account_number": + panic(fmt.Errorf("field account_number of message cosmos.accounts.v1.GenesisAccount is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.GenesisAccount")) @@ -849,9 +868,11 @@ func (x *fastReflection_GenesisAccount) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "cosmos.accounts.v1.GenesisAccount.account_type": return protoreflect.ValueOfString("") + case "cosmos.accounts.v1.GenesisAccount.account_number": + return protoreflect.ValueOfUint64(uint64(0)) case "cosmos.accounts.v1.GenesisAccount.state": list := []*KVPair{} - return protoreflect.ValueOfList(&_GenesisAccount_3_list{list: &list}) + return protoreflect.ValueOfList(&_GenesisAccount_4_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.GenesisAccount")) @@ -929,6 +950,9 @@ func (x *fastReflection_GenesisAccount) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.AccountNumber != 0 { + n += 1 + runtime.Sov(uint64(x.AccountNumber)) + } if len(x.State) > 0 { for _, e := range x.State { l = options.Size(e) @@ -977,9 +1001,14 @@ func (x *fastReflection_GenesisAccount) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } + if x.AccountNumber != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AccountNumber)) + i-- + dAtA[i] = 0x18 + } if len(x.AccountType) > 0 { i -= len(x.AccountType) copy(dAtA[i:], x.AccountType) @@ -1108,6 +1137,25 @@ func (x *fastReflection_GenesisAccount) ProtoMethods() *protoiface.Methods { x.AccountType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) + } + x.AccountNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AccountNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } @@ -1733,8 +1781,10 @@ type GenesisAccount struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // account_type is the account type of the account. AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` + // account_number is the account number of the account. + AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"` // state is the account state represented as a slice of raw key value byte pairs. - State []*KVPair `protobuf:"bytes,3,rep,name=state,proto3" json:"state,omitempty"` + State []*KVPair `protobuf:"bytes,4,rep,name=state,proto3" json:"state,omitempty"` } func (x *GenesisAccount) Reset() { @@ -1771,6 +1821,13 @@ func (x *GenesisAccount) GetAccountType() string { return "" } +func (x *GenesisAccount) GetAccountNumber() uint64 { + if x != nil { + return x.AccountNumber + } + return 0 +} + func (x *GenesisAccount) GetState() []*KVPair { if x != nil { return x.State @@ -1837,31 +1894,34 @@ var file_cosmos_accounts_v1_genesis_proto_rawDesc = []byte{ 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x7f, 0x0a, - 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x4b, 0x56, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x30, - 0x0a, 0x06, 0x4b, 0x56, 0x50, 0x61, 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x42, 0xc0, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, - 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, - 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, - 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, - 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0xa6, 0x01, + 0x0a, 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, + 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x56, 0x50, 0x61, 0x69, 0x72, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x30, 0x0a, 0x06, 0x4b, 0x56, 0x50, 0x61, 0x69, 0x72, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0xc0, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, + 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/api/cosmos/accounts/v1/query.pulsar.go b/api/cosmos/accounts/v1/query.pulsar.go index 2b96442b683f..d4a0ff1370d1 100644 --- a/api/cosmos/accounts/v1/query.pulsar.go +++ b/api/cosmos/accounts/v1/query.pulsar.go @@ -7,6 +7,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" io "io" reflect "reflect" sync "sync" @@ -96,8 +97,8 @@ func (x *fastReflection_AccountQueryRequest) Range(f func(protoreflect.FieldDesc return } } - if len(x.Request) != 0 { - value := protoreflect.ValueOfBytes(x.Request) + if x.Request != nil { + value := protoreflect.ValueOfMessage(x.Request.ProtoReflect()) if !f(fd_AccountQueryRequest_request, value) { return } @@ -120,7 +121,7 @@ func (x *fastReflection_AccountQueryRequest) Has(fd protoreflect.FieldDescriptor case "cosmos.accounts.v1.AccountQueryRequest.target": return x.Target != "" case "cosmos.accounts.v1.AccountQueryRequest.request": - return len(x.Request) != 0 + return x.Request != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest")) @@ -162,7 +163,7 @@ func (x *fastReflection_AccountQueryRequest) Get(descriptor protoreflect.FieldDe return protoreflect.ValueOfString(value) case "cosmos.accounts.v1.AccountQueryRequest.request": value := x.Request - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest")) @@ -186,7 +187,7 @@ func (x *fastReflection_AccountQueryRequest) Set(fd protoreflect.FieldDescriptor case "cosmos.accounts.v1.AccountQueryRequest.target": x.Target = value.Interface().(string) case "cosmos.accounts.v1.AccountQueryRequest.request": - x.Request = value.Bytes() + x.Request = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest")) @@ -207,10 +208,13 @@ func (x *fastReflection_AccountQueryRequest) Set(fd protoreflect.FieldDescriptor // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_AccountQueryRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.accounts.v1.AccountQueryRequest.request": + if x.Request == nil { + x.Request = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.Request.ProtoReflect()) case "cosmos.accounts.v1.AccountQueryRequest.target": panic(fmt.Errorf("field target of message cosmos.accounts.v1.AccountQueryRequest is not mutable")) - case "cosmos.accounts.v1.AccountQueryRequest.request": - panic(fmt.Errorf("field request of message cosmos.accounts.v1.AccountQueryRequest is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest")) @@ -227,7 +231,8 @@ func (x *fastReflection_AccountQueryRequest) NewField(fd protoreflect.FieldDescr case "cosmos.accounts.v1.AccountQueryRequest.target": return protoreflect.ValueOfString("") case "cosmos.accounts.v1.AccountQueryRequest.request": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest")) @@ -301,8 +306,8 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Request) - if l > 0 { + if x.Request != nil { + l = options.Size(x.Request) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -334,10 +339,17 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Request) > 0 { - i -= len(x.Request) - copy(dAtA[i:], x.Request) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Request))) + if x.Request != nil { + encoded, err := options.Marshal(x.Request) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x12 } @@ -433,7 +445,7 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -443,24 +455,26 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Request = append(x.Request[:0], dAtA[iNdEx:postIndex]...) if x.Request == nil { - x.Request = []byte{} + x.Request = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Request); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -574,8 +588,8 @@ func (x *fastReflection_AccountQueryResponse) Interface() protoreflect.ProtoMess // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_AccountQueryResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Response) != 0 { - value := protoreflect.ValueOfBytes(x.Response) + if x.Response != nil { + value := protoreflect.ValueOfMessage(x.Response.ProtoReflect()) if !f(fd_AccountQueryResponse_response, value) { return } @@ -596,7 +610,7 @@ func (x *fastReflection_AccountQueryResponse) Range(f func(protoreflect.FieldDes func (x *fastReflection_AccountQueryResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "cosmos.accounts.v1.AccountQueryResponse.response": - return len(x.Response) != 0 + return x.Response != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse")) @@ -633,7 +647,7 @@ func (x *fastReflection_AccountQueryResponse) Get(descriptor protoreflect.FieldD switch descriptor.FullName() { case "cosmos.accounts.v1.AccountQueryResponse.response": value := x.Response - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse")) @@ -655,7 +669,7 @@ func (x *fastReflection_AccountQueryResponse) Get(descriptor protoreflect.FieldD func (x *fastReflection_AccountQueryResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "cosmos.accounts.v1.AccountQueryResponse.response": - x.Response = value.Bytes() + x.Response = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse")) @@ -677,7 +691,10 @@ func (x *fastReflection_AccountQueryResponse) Set(fd protoreflect.FieldDescripto func (x *fastReflection_AccountQueryResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.v1.AccountQueryResponse.response": - panic(fmt.Errorf("field response of message cosmos.accounts.v1.AccountQueryResponse is not mutable")) + if x.Response == nil { + x.Response = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.Response.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse")) @@ -692,7 +709,8 @@ func (x *fastReflection_AccountQueryResponse) Mutable(fd protoreflect.FieldDescr func (x *fastReflection_AccountQueryResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.v1.AccountQueryResponse.response": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse")) @@ -762,8 +780,8 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods var n int var l int _ = l - l = len(x.Response) - if l > 0 { + if x.Response != nil { + l = options.Size(x.Response) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -795,10 +813,17 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Response) > 0 { - i -= len(x.Response) - copy(dAtA[i:], x.Response) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Response))) + if x.Response != nil { + encoded, err := options.Marshal(x.Response) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0xa } @@ -855,7 +880,7 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -865,24 +890,26 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Response = append(x.Response[:0], dAtA[iNdEx:postIndex]...) if x.Response == nil { - x.Response = []byte{} + x.Response = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Response); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -3397,7 +3424,7 @@ type AccountQueryRequest struct { // target defines the account to be queried. Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` // request defines the query message being sent to the account. - Request []byte `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` + Request *anypb.Any `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` } func (x *AccountQueryRequest) Reset() { @@ -3427,7 +3454,7 @@ func (x *AccountQueryRequest) GetTarget() string { return "" } -func (x *AccountQueryRequest) GetRequest() []byte { +func (x *AccountQueryRequest) GetRequest() *anypb.Any { if x != nil { return x.Request } @@ -3441,7 +3468,7 @@ type AccountQueryResponse struct { unknownFields protoimpl.UnknownFields // response defines the query response of the account. - Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` + Response *anypb.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` } func (x *AccountQueryResponse) Reset() { @@ -3464,7 +3491,7 @@ func (*AccountQueryResponse) Descriptor() ([]byte, []int) { return file_cosmos_accounts_v1_query_proto_rawDescGZIP(), []int{1} } -func (x *AccountQueryResponse) GetResponse() []byte { +func (x *AccountQueryResponse) GetResponse() *anypb.Any { if x != nil { return x.Response } @@ -3691,76 +3718,80 @@ var file_cosmos_accounts_v1_query_proto_rawDesc = []byte{ 0x0a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x22, 0x47, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x32, 0x0a, - 0x14, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x32, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0xc8, 0x02, 0x0a, 0x0e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0b, 0x69, 0x6e, 0x69, 0x74, - 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x55, 0x0a, 0x10, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, - 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x0f, 0x65, 0x78, 0x65, - 0x63, 0x75, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x51, 0x0a, 0x0e, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, + 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x5d, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, + 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x48, + 0x0a, 0x14, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0xc8, 0x02, 0x0a, + 0x0e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4b, 0x0a, 0x0b, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, - 0x52, 0x0d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x1a, - 0x3f, 0x0a, 0x07, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x2e, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x22, 0x38, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x32, 0xa1, 0x02, 0x0a, 0x05, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x12, 0x63, 0x0a, 0x0c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, + 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x55, 0x0a, 0x10, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x72, 0x52, 0x0f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, + 0x65, 0x72, 0x73, 0x12, 0x51, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x68, 0x61, 0x6e, + 0x64, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x0d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x48, 0x61, + 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x1a, 0x3f, 0x0a, 0x07, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, + 0x72, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x38, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x32, 0xa1, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x63, 0x0a, 0x0c, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, + 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x51, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x06, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x0b, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x2e, 0x63, 0x6f, + 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xbe, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xbe, - 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, - 0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, + 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, + 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3784,22 +3815,25 @@ var file_cosmos_accounts_v1_query_proto_goTypes = []interface{}{ (*AccountTypeRequest)(nil), // 4: cosmos.accounts.v1.AccountTypeRequest (*AccountTypeResponse)(nil), // 5: cosmos.accounts.v1.AccountTypeResponse (*SchemaResponse_Handler)(nil), // 6: cosmos.accounts.v1.SchemaResponse.Handler + (*anypb.Any)(nil), // 7: google.protobuf.Any } var file_cosmos_accounts_v1_query_proto_depIdxs = []int32{ - 6, // 0: cosmos.accounts.v1.SchemaResponse.init_schema:type_name -> cosmos.accounts.v1.SchemaResponse.Handler - 6, // 1: cosmos.accounts.v1.SchemaResponse.execute_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler - 6, // 2: cosmos.accounts.v1.SchemaResponse.query_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler - 0, // 3: cosmos.accounts.v1.Query.AccountQuery:input_type -> cosmos.accounts.v1.AccountQueryRequest - 2, // 4: cosmos.accounts.v1.Query.Schema:input_type -> cosmos.accounts.v1.SchemaRequest - 4, // 5: cosmos.accounts.v1.Query.AccountType:input_type -> cosmos.accounts.v1.AccountTypeRequest - 1, // 6: cosmos.accounts.v1.Query.AccountQuery:output_type -> cosmos.accounts.v1.AccountQueryResponse - 3, // 7: cosmos.accounts.v1.Query.Schema:output_type -> cosmos.accounts.v1.SchemaResponse - 5, // 8: cosmos.accounts.v1.Query.AccountType:output_type -> cosmos.accounts.v1.AccountTypeResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 7, // 0: cosmos.accounts.v1.AccountQueryRequest.request:type_name -> google.protobuf.Any + 7, // 1: cosmos.accounts.v1.AccountQueryResponse.response:type_name -> google.protobuf.Any + 6, // 2: cosmos.accounts.v1.SchemaResponse.init_schema:type_name -> cosmos.accounts.v1.SchemaResponse.Handler + 6, // 3: cosmos.accounts.v1.SchemaResponse.execute_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler + 6, // 4: cosmos.accounts.v1.SchemaResponse.query_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler + 0, // 5: cosmos.accounts.v1.Query.AccountQuery:input_type -> cosmos.accounts.v1.AccountQueryRequest + 2, // 6: cosmos.accounts.v1.Query.Schema:input_type -> cosmos.accounts.v1.SchemaRequest + 4, // 7: cosmos.accounts.v1.Query.AccountType:input_type -> cosmos.accounts.v1.AccountTypeRequest + 1, // 8: cosmos.accounts.v1.Query.AccountQuery:output_type -> cosmos.accounts.v1.AccountQueryResponse + 3, // 9: cosmos.accounts.v1.Query.Schema:output_type -> cosmos.accounts.v1.SchemaResponse + 5, // 10: cosmos.accounts.v1.Query.AccountType:output_type -> cosmos.accounts.v1.AccountTypeResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_cosmos_accounts_v1_query_proto_init() } diff --git a/api/cosmos/accounts/v1/tx.pulsar.go b/api/cosmos/accounts/v1/tx.pulsar.go index d9f80bfe3d5e..13444ee0405c 100644 --- a/api/cosmos/accounts/v1/tx.pulsar.go +++ b/api/cosmos/accounts/v1/tx.pulsar.go @@ -8,6 +8,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" io "io" reflect "reflect" sync "sync" @@ -105,8 +106,8 @@ func (x *fastReflection_MsgInit) Range(f func(protoreflect.FieldDescriptor, prot return } } - if len(x.Message) != 0 { - value := protoreflect.ValueOfBytes(x.Message) + if x.Message != nil { + value := protoreflect.ValueOfMessage(x.Message.ProtoReflect()) if !f(fd_MsgInit_message, value) { return } @@ -131,7 +132,7 @@ func (x *fastReflection_MsgInit) Has(fd protoreflect.FieldDescriptor) bool { case "cosmos.accounts.v1.MsgInit.account_type": return x.AccountType != "" case "cosmos.accounts.v1.MsgInit.message": - return len(x.Message) != 0 + return x.Message != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -178,7 +179,7 @@ func (x *fastReflection_MsgInit) Get(descriptor protoreflect.FieldDescriptor) pr return protoreflect.ValueOfString(value) case "cosmos.accounts.v1.MsgInit.message": value := x.Message - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -204,7 +205,7 @@ func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value prot case "cosmos.accounts.v1.MsgInit.account_type": x.AccountType = value.Interface().(string) case "cosmos.accounts.v1.MsgInit.message": - x.Message = value.Bytes() + x.Message = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -225,12 +226,15 @@ func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value prot // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgInit) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.accounts.v1.MsgInit.message": + if x.Message == nil { + x.Message = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.Message.ProtoReflect()) case "cosmos.accounts.v1.MsgInit.sender": panic(fmt.Errorf("field sender of message cosmos.accounts.v1.MsgInit is not mutable")) case "cosmos.accounts.v1.MsgInit.account_type": panic(fmt.Errorf("field account_type of message cosmos.accounts.v1.MsgInit is not mutable")) - case "cosmos.accounts.v1.MsgInit.message": - panic(fmt.Errorf("field message of message cosmos.accounts.v1.MsgInit is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -249,7 +253,8 @@ func (x *fastReflection_MsgInit) NewField(fd protoreflect.FieldDescriptor) proto case "cosmos.accounts.v1.MsgInit.account_type": return protoreflect.ValueOfString("") case "cosmos.accounts.v1.MsgInit.message": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit")) @@ -327,8 +332,8 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Message) - if l > 0 { + if x.Message != nil { + l = options.Size(x.Message) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -360,10 +365,17 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Message) > 0 { - i -= len(x.Message) - copy(dAtA[i:], x.Message) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Message))) + if x.Message != nil { + encoded, err := options.Marshal(x.Message) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x1a } @@ -498,7 +510,7 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -508,24 +520,26 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Message = append(x.Message[:0], dAtA[iNdEx:postIndex]...) if x.Message == nil { - x.Message = []byte{} + x.Message = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Message); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -647,8 +661,8 @@ func (x *fastReflection_MsgInitResponse) Range(f func(protoreflect.FieldDescript return } } - if len(x.Response) != 0 { - value := protoreflect.ValueOfBytes(x.Response) + if x.Response != nil { + value := protoreflect.ValueOfMessage(x.Response.ProtoReflect()) if !f(fd_MsgInitResponse_response, value) { return } @@ -671,7 +685,7 @@ func (x *fastReflection_MsgInitResponse) Has(fd protoreflect.FieldDescriptor) bo case "cosmos.accounts.v1.MsgInitResponse.account_address": return x.AccountAddress != "" case "cosmos.accounts.v1.MsgInitResponse.response": - return len(x.Response) != 0 + return x.Response != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse")) @@ -713,7 +727,7 @@ func (x *fastReflection_MsgInitResponse) Get(descriptor protoreflect.FieldDescri return protoreflect.ValueOfString(value) case "cosmos.accounts.v1.MsgInitResponse.response": value := x.Response - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse")) @@ -737,7 +751,7 @@ func (x *fastReflection_MsgInitResponse) Set(fd protoreflect.FieldDescriptor, va case "cosmos.accounts.v1.MsgInitResponse.account_address": x.AccountAddress = value.Interface().(string) case "cosmos.accounts.v1.MsgInitResponse.response": - x.Response = value.Bytes() + x.Response = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse")) @@ -758,10 +772,13 @@ func (x *fastReflection_MsgInitResponse) Set(fd protoreflect.FieldDescriptor, va // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgInitResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.accounts.v1.MsgInitResponse.response": + if x.Response == nil { + x.Response = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.Response.ProtoReflect()) case "cosmos.accounts.v1.MsgInitResponse.account_address": panic(fmt.Errorf("field account_address of message cosmos.accounts.v1.MsgInitResponse is not mutable")) - case "cosmos.accounts.v1.MsgInitResponse.response": - panic(fmt.Errorf("field response of message cosmos.accounts.v1.MsgInitResponse is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse")) @@ -778,7 +795,8 @@ func (x *fastReflection_MsgInitResponse) NewField(fd protoreflect.FieldDescripto case "cosmos.accounts.v1.MsgInitResponse.account_address": return protoreflect.ValueOfString("") case "cosmos.accounts.v1.MsgInitResponse.response": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse")) @@ -852,8 +870,8 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Response) - if l > 0 { + if x.Response != nil { + l = options.Size(x.Response) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -885,10 +903,17 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Response) > 0 { - i -= len(x.Response) - copy(dAtA[i:], x.Response) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Response))) + if x.Response != nil { + encoded, err := options.Marshal(x.Response) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x12 } @@ -984,7 +1009,7 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -994,24 +1019,26 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Response = append(x.Response[:0], dAtA[iNdEx:postIndex]...) if x.Response == nil { - x.Response = []byte{} + x.Response = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Response); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -1141,8 +1168,8 @@ func (x *fastReflection_MsgExecute) Range(f func(protoreflect.FieldDescriptor, p return } } - if len(x.Message) != 0 { - value := protoreflect.ValueOfBytes(x.Message) + if x.Message != nil { + value := protoreflect.ValueOfMessage(x.Message.ProtoReflect()) if !f(fd_MsgExecute_message, value) { return } @@ -1167,7 +1194,7 @@ func (x *fastReflection_MsgExecute) Has(fd protoreflect.FieldDescriptor) bool { case "cosmos.accounts.v1.MsgExecute.target": return x.Target != "" case "cosmos.accounts.v1.MsgExecute.message": - return len(x.Message) != 0 + return x.Message != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1214,7 +1241,7 @@ func (x *fastReflection_MsgExecute) Get(descriptor protoreflect.FieldDescriptor) return protoreflect.ValueOfString(value) case "cosmos.accounts.v1.MsgExecute.message": value := x.Message - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1240,7 +1267,7 @@ func (x *fastReflection_MsgExecute) Set(fd protoreflect.FieldDescriptor, value p case "cosmos.accounts.v1.MsgExecute.target": x.Target = value.Interface().(string) case "cosmos.accounts.v1.MsgExecute.message": - x.Message = value.Bytes() + x.Message = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1261,12 +1288,15 @@ func (x *fastReflection_MsgExecute) Set(fd protoreflect.FieldDescriptor, value p // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgExecute) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.accounts.v1.MsgExecute.message": + if x.Message == nil { + x.Message = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.Message.ProtoReflect()) case "cosmos.accounts.v1.MsgExecute.sender": panic(fmt.Errorf("field sender of message cosmos.accounts.v1.MsgExecute is not mutable")) case "cosmos.accounts.v1.MsgExecute.target": panic(fmt.Errorf("field target of message cosmos.accounts.v1.MsgExecute is not mutable")) - case "cosmos.accounts.v1.MsgExecute.message": - panic(fmt.Errorf("field message of message cosmos.accounts.v1.MsgExecute is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1285,7 +1315,8 @@ func (x *fastReflection_MsgExecute) NewField(fd protoreflect.FieldDescriptor) pr case "cosmos.accounts.v1.MsgExecute.target": return protoreflect.ValueOfString("") case "cosmos.accounts.v1.MsgExecute.message": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute")) @@ -1363,8 +1394,8 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Message) - if l > 0 { + if x.Message != nil { + l = options.Size(x.Message) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -1396,10 +1427,17 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Message) > 0 { - i -= len(x.Message) - copy(dAtA[i:], x.Message) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Message))) + if x.Message != nil { + encoded, err := options.Marshal(x.Message) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x1a } @@ -1534,7 +1572,7 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1544,24 +1582,26 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Message = append(x.Message[:0], dAtA[iNdEx:postIndex]...) if x.Message == nil { - x.Message = []byte{} + x.Message = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Message); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -1675,8 +1715,8 @@ func (x *fastReflection_MsgExecuteResponse) Interface() protoreflect.ProtoMessag // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgExecuteResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Response) != 0 { - value := protoreflect.ValueOfBytes(x.Response) + if x.Response != nil { + value := protoreflect.ValueOfMessage(x.Response.ProtoReflect()) if !f(fd_MsgExecuteResponse_response, value) { return } @@ -1697,7 +1737,7 @@ func (x *fastReflection_MsgExecuteResponse) Range(f func(protoreflect.FieldDescr func (x *fastReflection_MsgExecuteResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "cosmos.accounts.v1.MsgExecuteResponse.response": - return len(x.Response) != 0 + return x.Response != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse")) @@ -1734,7 +1774,7 @@ func (x *fastReflection_MsgExecuteResponse) Get(descriptor protoreflect.FieldDes switch descriptor.FullName() { case "cosmos.accounts.v1.MsgExecuteResponse.response": value := x.Response - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse")) @@ -1756,7 +1796,7 @@ func (x *fastReflection_MsgExecuteResponse) Get(descriptor protoreflect.FieldDes func (x *fastReflection_MsgExecuteResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "cosmos.accounts.v1.MsgExecuteResponse.response": - x.Response = value.Bytes() + x.Response = value.Message().Interface().(*anypb.Any) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse")) @@ -1778,7 +1818,10 @@ func (x *fastReflection_MsgExecuteResponse) Set(fd protoreflect.FieldDescriptor, func (x *fastReflection_MsgExecuteResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.v1.MsgExecuteResponse.response": - panic(fmt.Errorf("field response of message cosmos.accounts.v1.MsgExecuteResponse is not mutable")) + if x.Response == nil { + x.Response = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.Response.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse")) @@ -1793,7 +1836,8 @@ func (x *fastReflection_MsgExecuteResponse) Mutable(fd protoreflect.FieldDescrip func (x *fastReflection_MsgExecuteResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "cosmos.accounts.v1.MsgExecuteResponse.response": - return protoreflect.ValueOfBytes(nil) + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse")) @@ -1863,8 +1907,8 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Response) - if l > 0 { + if x.Response != nil { + l = options.Size(x.Response) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -1896,10 +1940,17 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Response) > 0 { - i -= len(x.Response) - copy(dAtA[i:], x.Response) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Response))) + if x.Response != nil { + encoded, err := options.Marshal(x.Response) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0xa } @@ -1956,7 +2007,7 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1966,24 +2017,26 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Response = append(x.Response[:0], dAtA[iNdEx:postIndex]...) if x.Response == nil { - x.Response = []byte{} + x.Response = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Response); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex default: @@ -3096,10 +3149,8 @@ type MsgInit struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // account_type is the type of the account to be created. AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` - // message is the message to be sent to the account, it's up to the account - // implementation to decide what encoding format should be used to interpret - // this message. - Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // message is the message to be sent to the account. + Message *anypb.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` } func (x *MsgInit) Reset() { @@ -3136,7 +3187,7 @@ func (x *MsgInit) GetAccountType() string { return "" } -func (x *MsgInit) GetMessage() []byte { +func (x *MsgInit) GetMessage() *anypb.Any { if x != nil { return x.Message } @@ -3152,7 +3203,7 @@ type MsgInitResponse struct { // account_address is the address of the newly created account. AccountAddress string `protobuf:"bytes,1,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"` // response is the response returned by the account implementation. - Response []byte `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` + Response *anypb.Any `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` } func (x *MsgInitResponse) Reset() { @@ -3182,7 +3233,7 @@ func (x *MsgInitResponse) GetAccountAddress() string { return "" } -func (x *MsgInitResponse) GetResponse() []byte { +func (x *MsgInitResponse) GetResponse() *anypb.Any { if x != nil { return x.Response } @@ -3199,8 +3250,8 @@ type MsgExecute struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // target is the address of the account to be executed. Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` - // message is the message to be sent to the account, it's up to the account - Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // message is the message to be sent to the account. + Message *anypb.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` } func (x *MsgExecute) Reset() { @@ -3237,7 +3288,7 @@ func (x *MsgExecute) GetTarget() string { return "" } -func (x *MsgExecute) GetMessage() []byte { +func (x *MsgExecute) GetMessage() *anypb.Any { if x != nil { return x.Message } @@ -3251,7 +3302,7 @@ type MsgExecuteResponse struct { unknownFields protoimpl.UnknownFields // response is the response returned by the account implementation. - Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` + Response *anypb.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` } func (x *MsgExecuteResponse) Reset() { @@ -3274,7 +3325,7 @@ func (*MsgExecuteResponse) Descriptor() ([]byte, []int) { return file_cosmos_accounts_v1_tx_proto_rawDescGZIP(), []int{3} } -func (x *MsgExecuteResponse) GetResponse() []byte { +func (x *MsgExecuteResponse) GetResponse() *anypb.Any { if x != nil { return x.Response } @@ -3371,76 +3422,84 @@ var file_cosmos_accounts_v1_tx_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, - 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6b, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49, - 0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x56, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x63, 0x0a, - 0x0a, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x22, 0x30, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7d, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x6e, 0x64, - 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x6e, 0x64, 0x6c, - 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x81, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, + 0x79, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x6c, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, + 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x79, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x74, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x22, 0x46, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7d, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, + 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, + 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x63, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x45, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x62, 0x75, 0x6e, 0x64, - 0x6c, 0x65, 0x72, 0x22, 0x63, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, - 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x47, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x8e, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x48, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x8e, 0x02, 0x0a, + 0x03, 0x4d, 0x73, 0x67, 0x12, 0x48, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x1b, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, + 0x0a, 0x07, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x63, 0x0a, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, + 0x6c, 0x65, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x49, 0x6e, 0x69, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e, - 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x07, 0x45, 0x78, - 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, - 0x65, 0x63, 0x75, 0x74, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, - 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, - 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x24, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, - 0x6e, 0x64, 0x6c, 0x65, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, - 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbb, 0x01, 0x0a, 0x16, 0x63, 0x6f, - 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbb, 0x01, + 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, + 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -3463,23 +3522,28 @@ var file_cosmos_accounts_v1_tx_proto_goTypes = []interface{}{ (*MsgExecuteResponse)(nil), // 3: cosmos.accounts.v1.MsgExecuteResponse (*MsgExecuteBundle)(nil), // 4: cosmos.accounts.v1.MsgExecuteBundle (*MsgExecuteBundleResponse)(nil), // 5: cosmos.accounts.v1.MsgExecuteBundleResponse - (*UserOperation)(nil), // 6: cosmos.accounts.v1.UserOperation - (*UserOperationResponse)(nil), // 7: cosmos.accounts.v1.UserOperationResponse + (*anypb.Any)(nil), // 6: google.protobuf.Any + (*UserOperation)(nil), // 7: cosmos.accounts.v1.UserOperation + (*UserOperationResponse)(nil), // 8: cosmos.accounts.v1.UserOperationResponse } var file_cosmos_accounts_v1_tx_proto_depIdxs = []int32{ - 6, // 0: cosmos.accounts.v1.MsgExecuteBundle.operations:type_name -> cosmos.accounts.v1.UserOperation - 7, // 1: cosmos.accounts.v1.MsgExecuteBundleResponse.responses:type_name -> cosmos.accounts.v1.UserOperationResponse - 0, // 2: cosmos.accounts.v1.Msg.Init:input_type -> cosmos.accounts.v1.MsgInit - 2, // 3: cosmos.accounts.v1.Msg.Execute:input_type -> cosmos.accounts.v1.MsgExecute - 4, // 4: cosmos.accounts.v1.Msg.ExecuteBundle:input_type -> cosmos.accounts.v1.MsgExecuteBundle - 1, // 5: cosmos.accounts.v1.Msg.Init:output_type -> cosmos.accounts.v1.MsgInitResponse - 3, // 6: cosmos.accounts.v1.Msg.Execute:output_type -> cosmos.accounts.v1.MsgExecuteResponse - 5, // 7: cosmos.accounts.v1.Msg.ExecuteBundle:output_type -> cosmos.accounts.v1.MsgExecuteBundleResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 6, // 0: cosmos.accounts.v1.MsgInit.message:type_name -> google.protobuf.Any + 6, // 1: cosmos.accounts.v1.MsgInitResponse.response:type_name -> google.protobuf.Any + 6, // 2: cosmos.accounts.v1.MsgExecute.message:type_name -> google.protobuf.Any + 6, // 3: cosmos.accounts.v1.MsgExecuteResponse.response:type_name -> google.protobuf.Any + 7, // 4: cosmos.accounts.v1.MsgExecuteBundle.operations:type_name -> cosmos.accounts.v1.UserOperation + 8, // 5: cosmos.accounts.v1.MsgExecuteBundleResponse.responses:type_name -> cosmos.accounts.v1.UserOperationResponse + 0, // 6: cosmos.accounts.v1.Msg.Init:input_type -> cosmos.accounts.v1.MsgInit + 2, // 7: cosmos.accounts.v1.Msg.Execute:input_type -> cosmos.accounts.v1.MsgExecute + 4, // 8: cosmos.accounts.v1.Msg.ExecuteBundle:input_type -> cosmos.accounts.v1.MsgExecuteBundle + 1, // 9: cosmos.accounts.v1.Msg.Init:output_type -> cosmos.accounts.v1.MsgInitResponse + 3, // 10: cosmos.accounts.v1.Msg.Execute:output_type -> cosmos.accounts.v1.MsgExecuteResponse + 5, // 11: cosmos.accounts.v1.Msg.ExecuteBundle:output_type -> cosmos.accounts.v1.MsgExecuteBundleResponse + 9, // [9:12] is the sub-list for method output_type + 6, // [6:9] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_cosmos_accounts_v1_tx_proto_init() } diff --git a/api/cosmos/authz/v1beta1/event.pulsar.go b/api/cosmos/authz/v1beta1/event.pulsar.go index 88a142363ea2..0d93ad1a420e 100644 --- a/api/cosmos/authz/v1beta1/event.pulsar.go +++ b/api/cosmos/authz/v1beta1/event.pulsar.go @@ -1130,7 +1130,7 @@ type EventGrant struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Msg type URL for which an autorization is granted + // Msg type URL for which an authorization is granted MsgTypeUrl string `protobuf:"bytes,2,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` // Granter account address Granter string `protobuf:"bytes,3,opt,name=granter,proto3" json:"granter,omitempty"` @@ -1185,7 +1185,7 @@ type EventRevoke struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Msg type URL for which an autorization is revoked + // Msg type URL for which an authorization is revoked MsgTypeUrl string `protobuf:"bytes,2,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` // Granter account address Granter string `protobuf:"bytes,3,opt,name=granter,proto3" json:"granter,omitempty"` diff --git a/api/cosmos/base/reflection/v2alpha1/reflection.pulsar.go b/api/cosmos/base/reflection/v2alpha1/reflection.pulsar.go index c0910852b765..cbe1d3f25f7a 100644 --- a/api/cosmos/base/reflection/v2alpha1/reflection.pulsar.go +++ b/api/cosmos/base/reflection/v2alpha1/reflection.pulsar.go @@ -12271,7 +12271,7 @@ type AppDescriptor struct { Codec *CodecDescriptor `protobuf:"bytes,3,opt,name=codec,proto3" json:"codec,omitempty"` // configuration provides metadata information regarding the sdk.Config type Configuration *ConfigurationDescriptor `protobuf:"bytes,4,opt,name=configuration,proto3" json:"configuration,omitempty"` - // query_services provides metadata information regarding the available queriable endpoints + // query_services provides metadata information regarding the available queryable endpoints QueryServices *QueryServicesDescriptor `protobuf:"bytes,5,opt,name=query_services,json=queryServices,proto3" json:"query_services,omitempty"` // tx provides metadata information regarding how to send transactions to the given application Tx *TxDescriptor `protobuf:"bytes,6,opt,name=tx,proto3" json:"tx,omitempty"` @@ -13171,7 +13171,7 @@ func (x *GetTxDescriptorResponse) GetTx() *TxDescriptor { return nil } -// QueryServicesDescriptor contains the list of cosmos-sdk queriable services +// QueryServicesDescriptor contains the list of cosmos-sdk queryable services type QueryServicesDescriptor struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/api/cosmos/gov/v1/genesis.pulsar.go b/api/cosmos/gov/v1/genesis.pulsar.go index 3f932406779b..2afcb1be6bae 100644 --- a/api/cosmos/gov/v1/genesis.pulsar.go +++ b/api/cosmos/gov/v1/genesis.pulsar.go @@ -1240,21 +1240,21 @@ type GenesisState struct { // proposals defines all the proposals present at genesis. Proposals []*Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"` // Deprecated: Prefer to use `params` instead. - // deposit_params defines all the paramaters of related to deposit. + // deposit_params defines all the parameters of related to deposit. // // Deprecated: Do not use. DepositParams *DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` // Deprecated: Prefer to use `params` instead. - // voting_params defines all the paramaters of related to voting. + // voting_params defines all the parameters of related to voting. // // Deprecated: Do not use. VotingParams *VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` // Deprecated: Prefer to use `params` instead. - // tally_params defines all the paramaters of related to tally. + // tally_params defines all the parameters of related to tally. // // Deprecated: Do not use. TallyParams *TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` - // params defines all the paramaters of x/gov module. + // params defines all the parameters of x/gov module. // // Since: cosmos-sdk 0.47 Params *Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params,omitempty"` diff --git a/api/cosmos/gov/v1/gov.pulsar.go b/api/cosmos/gov/v1/gov.pulsar.go index 1200fbc1e4aa..d2a45c71478a 100644 --- a/api/cosmos/gov/v1/gov.pulsar.go +++ b/api/cosmos/gov/v1/gov.pulsar.go @@ -1212,6 +1212,7 @@ var ( fd_Proposal_proposer protoreflect.FieldDescriptor fd_Proposal_expedited protoreflect.FieldDescriptor fd_Proposal_failed_reason protoreflect.FieldDescriptor + fd_Proposal_proposal_type protoreflect.FieldDescriptor ) func init() { @@ -1232,6 +1233,7 @@ func init() { fd_Proposal_proposer = md_Proposal.Fields().ByName("proposer") fd_Proposal_expedited = md_Proposal.Fields().ByName("expedited") fd_Proposal_failed_reason = md_Proposal.Fields().ByName("failed_reason") + fd_Proposal_proposal_type = md_Proposal.Fields().ByName("proposal_type") } var _ protoreflect.Message = (*fastReflection_Proposal)(nil) @@ -1389,6 +1391,12 @@ func (x *fastReflection_Proposal) Range(f func(protoreflect.FieldDescriptor, pro return } } + if x.ProposalType != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.ProposalType)) + if !f(fd_Proposal_proposal_type, value) { + return + } + } } // Has reports whether a field is populated. @@ -1434,6 +1442,8 @@ func (x *fastReflection_Proposal) Has(fd protoreflect.FieldDescriptor) bool { return x.Expedited != false case "cosmos.gov.v1.Proposal.failed_reason": return x.FailedReason != "" + case "cosmos.gov.v1.Proposal.proposal_type": + return x.ProposalType != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1480,6 +1490,8 @@ func (x *fastReflection_Proposal) Clear(fd protoreflect.FieldDescriptor) { x.Expedited = false case "cosmos.gov.v1.Proposal.failed_reason": x.FailedReason = "" + case "cosmos.gov.v1.Proposal.proposal_type": + x.ProposalType = 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1547,6 +1559,9 @@ func (x *fastReflection_Proposal) Get(descriptor protoreflect.FieldDescriptor) p case "cosmos.gov.v1.Proposal.failed_reason": value := x.FailedReason return protoreflect.ValueOfString(value) + case "cosmos.gov.v1.Proposal.proposal_type": + value := x.ProposalType + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1601,6 +1616,8 @@ func (x *fastReflection_Proposal) Set(fd protoreflect.FieldDescriptor, value pro x.Expedited = value.Bool() case "cosmos.gov.v1.Proposal.failed_reason": x.FailedReason = value.Interface().(string) + case "cosmos.gov.v1.Proposal.proposal_type": + x.ProposalType = (ProposalType)(value.Enum()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1674,6 +1691,8 @@ func (x *fastReflection_Proposal) Mutable(fd protoreflect.FieldDescriptor) proto panic(fmt.Errorf("field expedited of message cosmos.gov.v1.Proposal is not mutable")) case "cosmos.gov.v1.Proposal.failed_reason": panic(fmt.Errorf("field failed_reason of message cosmos.gov.v1.Proposal is not mutable")) + case "cosmos.gov.v1.Proposal.proposal_type": + panic(fmt.Errorf("field proposal_type of message cosmos.gov.v1.Proposal is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1724,6 +1743,8 @@ func (x *fastReflection_Proposal) NewField(fd protoreflect.FieldDescriptor) prot return protoreflect.ValueOfBool(false) case "cosmos.gov.v1.Proposal.failed_reason": return protoreflect.ValueOfString("") + case "cosmos.gov.v1.Proposal.proposal_type": + return protoreflect.ValueOfEnum(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.Proposal")) @@ -1854,6 +1875,9 @@ func (x *fastReflection_Proposal) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.ProposalType != 0 { + n += 2 + runtime.Sov(uint64(x.ProposalType)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1883,6 +1907,13 @@ func (x *fastReflection_Proposal) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.ProposalType != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ProposalType)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } if len(x.FailedReason) > 0 { i -= len(x.FailedReason) copy(dAtA[i:], x.FailedReason) @@ -2555,6 +2586,25 @@ func (x *fastReflection_Proposal) ProtoMethods() *protoiface.Methods { } x.FailedReason = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 16: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProposalType", wireType) + } + x.ProposalType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.ProposalType |= ProposalType(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -2596,6 +2646,7 @@ var ( fd_TallyResult_abstain_count protoreflect.FieldDescriptor fd_TallyResult_no_count protoreflect.FieldDescriptor fd_TallyResult_no_with_veto_count protoreflect.FieldDescriptor + fd_TallyResult_spam_count protoreflect.FieldDescriptor ) func init() { @@ -2605,6 +2656,7 @@ func init() { fd_TallyResult_abstain_count = md_TallyResult.Fields().ByName("abstain_count") fd_TallyResult_no_count = md_TallyResult.Fields().ByName("no_count") fd_TallyResult_no_with_veto_count = md_TallyResult.Fields().ByName("no_with_veto_count") + fd_TallyResult_spam_count = md_TallyResult.Fields().ByName("spam_count") } var _ protoreflect.Message = (*fastReflection_TallyResult)(nil) @@ -2696,6 +2748,12 @@ func (x *fastReflection_TallyResult) Range(f func(protoreflect.FieldDescriptor, return } } + if x.SpamCount != "" { + value := protoreflect.ValueOfString(x.SpamCount) + if !f(fd_TallyResult_spam_count, value) { + return + } + } } // Has reports whether a field is populated. @@ -2719,6 +2777,8 @@ func (x *fastReflection_TallyResult) Has(fd protoreflect.FieldDescriptor) bool { return x.NoCount != "" case "cosmos.gov.v1.TallyResult.no_with_veto_count": return x.NoWithVetoCount != "" + case "cosmos.gov.v1.TallyResult.spam_count": + return x.SpamCount != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.TallyResult")) @@ -2743,6 +2803,8 @@ func (x *fastReflection_TallyResult) Clear(fd protoreflect.FieldDescriptor) { x.NoCount = "" case "cosmos.gov.v1.TallyResult.no_with_veto_count": x.NoWithVetoCount = "" + case "cosmos.gov.v1.TallyResult.spam_count": + x.SpamCount = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.TallyResult")) @@ -2771,6 +2833,9 @@ func (x *fastReflection_TallyResult) Get(descriptor protoreflect.FieldDescriptor case "cosmos.gov.v1.TallyResult.no_with_veto_count": value := x.NoWithVetoCount return protoreflect.ValueOfString(value) + case "cosmos.gov.v1.TallyResult.spam_count": + value := x.SpamCount + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.TallyResult")) @@ -2799,6 +2864,8 @@ func (x *fastReflection_TallyResult) Set(fd protoreflect.FieldDescriptor, value x.NoCount = value.Interface().(string) case "cosmos.gov.v1.TallyResult.no_with_veto_count": x.NoWithVetoCount = value.Interface().(string) + case "cosmos.gov.v1.TallyResult.spam_count": + x.SpamCount = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.TallyResult")) @@ -2827,6 +2894,8 @@ func (x *fastReflection_TallyResult) Mutable(fd protoreflect.FieldDescriptor) pr panic(fmt.Errorf("field no_count of message cosmos.gov.v1.TallyResult is not mutable")) case "cosmos.gov.v1.TallyResult.no_with_veto_count": panic(fmt.Errorf("field no_with_veto_count of message cosmos.gov.v1.TallyResult is not mutable")) + case "cosmos.gov.v1.TallyResult.spam_count": + panic(fmt.Errorf("field spam_count of message cosmos.gov.v1.TallyResult is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.TallyResult")) @@ -2848,6 +2917,8 @@ func (x *fastReflection_TallyResult) NewField(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfString("") case "cosmos.gov.v1.TallyResult.no_with_veto_count": return protoreflect.ValueOfString("") + case "cosmos.gov.v1.TallyResult.spam_count": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.TallyResult")) @@ -2933,6 +3004,10 @@ func (x *fastReflection_TallyResult) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.SpamCount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2962,6 +3037,13 @@ func (x *fastReflection_TallyResult) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.SpamCount) > 0 { + i -= len(x.SpamCount) + copy(dAtA[i:], x.SpamCount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SpamCount))) + i-- + dAtA[i] = 0x2a + } if len(x.NoWithVetoCount) > 0 { i -= len(x.NoWithVetoCount) copy(dAtA[i:], x.NoWithVetoCount) @@ -3167,6 +3249,38 @@ func (x *fastReflection_TallyResult) ProtoMethods() *protoiface.Methods { } x.NoWithVetoCount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SpamCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SpamCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -6988,37 +7102,119 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// ProposalType enumerates the valid proposal types. +// All proposal types are v1.Proposal which have different voting periods or tallying logic. +type ProposalType int32 + +const ( + // PROPOSAL_TYPE_UNSPECIFIED defines no proposal type, which fallback to PROPOSAL_TYPE_STANDARD. + ProposalType_PROPOSAL_TYPE_UNSPECIFIED ProposalType = 0 + // PROPOSAL_TYPE_STANDARD defines the type for a standard proposal. + ProposalType_PROPOSAL_TYPE_STANDARD ProposalType = 1 + // PROPOSAL_TYPE_MULTIPLE_CHOICE defines the type for a multiple choice proposal. + ProposalType_PROPOSAL_TYPE_MULTIPLE_CHOICE ProposalType = 2 + // PROPOSAL_TYPE_OPTIMISTIC defines the type for an optimistic proposal. + ProposalType_PROPOSAL_TYPE_OPTIMISTIC ProposalType = 3 + // PROPOSAL_TYPE_EXPEDITED defines the type for an expedited proposal. + ProposalType_PROPOSAL_TYPE_EXPEDITED ProposalType = 4 +) + +// Enum value maps for ProposalType. +var ( + ProposalType_name = map[int32]string{ + 0: "PROPOSAL_TYPE_UNSPECIFIED", + 1: "PROPOSAL_TYPE_STANDARD", + 2: "PROPOSAL_TYPE_MULTIPLE_CHOICE", + 3: "PROPOSAL_TYPE_OPTIMISTIC", + 4: "PROPOSAL_TYPE_EXPEDITED", + } + ProposalType_value = map[string]int32{ + "PROPOSAL_TYPE_UNSPECIFIED": 0, + "PROPOSAL_TYPE_STANDARD": 1, + "PROPOSAL_TYPE_MULTIPLE_CHOICE": 2, + "PROPOSAL_TYPE_OPTIMISTIC": 3, + "PROPOSAL_TYPE_EXPEDITED": 4, + } +) + +func (x ProposalType) Enum() *ProposalType { + p := new(ProposalType) + *p = x + return p +} + +func (x ProposalType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ProposalType) Descriptor() protoreflect.EnumDescriptor { + return file_cosmos_gov_v1_gov_proto_enumTypes[0].Descriptor() +} + +func (ProposalType) Type() protoreflect.EnumType { + return &file_cosmos_gov_v1_gov_proto_enumTypes[0] +} + +func (x ProposalType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ProposalType.Descriptor instead. +func (ProposalType) EnumDescriptor() ([]byte, []int) { + return file_cosmos_gov_v1_gov_proto_rawDescGZIP(), []int{0} +} + // VoteOption enumerates the valid vote options for a given governance proposal. type VoteOption int32 const ( // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 - // VOTE_OPTION_YES defines a yes vote option. + // VOTE_OPTION_ONE defines the first proposal vote option. + VoteOption_VOTE_OPTION_ONE VoteOption = 1 + // VOTE_OPTION_YES defines the yes proposal vote option. VoteOption_VOTE_OPTION_YES VoteOption = 1 - // VOTE_OPTION_ABSTAIN defines an abstain vote option. + // VOTE_OPTION_TWO defines the second proposal vote option. + VoteOption_VOTE_OPTION_TWO VoteOption = 2 + // VOTE_OPTION_ABSTAIN defines the abstain proposal vote option. VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 - // VOTE_OPTION_NO defines a no vote option. + // VOTE_OPTION_THREE defines the third proposal vote option. + VoteOption_VOTE_OPTION_THREE VoteOption = 3 + // VOTE_OPTION_NO defines the no proposal vote option. VoteOption_VOTE_OPTION_NO VoteOption = 3 - // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + // VOTE_OPTION_FOUR defines the fourth proposal vote option. + VoteOption_VOTE_OPTION_FOUR VoteOption = 4 + // VOTE_OPTION_NO_WITH_VETO defines the no with veto proposal vote option. VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 + // VOTE_OPTION_SPAM defines the spam proposal vote option. + VoteOption_VOTE_OPTION_SPAM VoteOption = 5 ) // Enum value maps for VoteOption. var ( VoteOption_name = map[int32]string{ 0: "VOTE_OPTION_UNSPECIFIED", - 1: "VOTE_OPTION_YES", - 2: "VOTE_OPTION_ABSTAIN", - 3: "VOTE_OPTION_NO", - 4: "VOTE_OPTION_NO_WITH_VETO", + 1: "VOTE_OPTION_ONE", + // Duplicate value: 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_TWO", + // Duplicate value: 2: "VOTE_OPTION_ABSTAIN", + 3: "VOTE_OPTION_THREE", + // Duplicate value: 3: "VOTE_OPTION_NO", + 4: "VOTE_OPTION_FOUR", + // Duplicate value: 4: "VOTE_OPTION_NO_WITH_VETO", + 5: "VOTE_OPTION_SPAM", } VoteOption_value = map[string]int32{ "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_ONE": 1, "VOTE_OPTION_YES": 1, + "VOTE_OPTION_TWO": 2, "VOTE_OPTION_ABSTAIN": 2, + "VOTE_OPTION_THREE": 3, "VOTE_OPTION_NO": 3, + "VOTE_OPTION_FOUR": 4, "VOTE_OPTION_NO_WITH_VETO": 4, + "VOTE_OPTION_SPAM": 5, } ) @@ -7033,11 +7229,11 @@ func (x VoteOption) String() string { } func (VoteOption) Descriptor() protoreflect.EnumDescriptor { - return file_cosmos_gov_v1_gov_proto_enumTypes[0].Descriptor() + return file_cosmos_gov_v1_gov_proto_enumTypes[1].Descriptor() } func (VoteOption) Type() protoreflect.EnumType { - return &file_cosmos_gov_v1_gov_proto_enumTypes[0] + return &file_cosmos_gov_v1_gov_proto_enumTypes[1] } func (x VoteOption) Number() protoreflect.EnumNumber { @@ -7046,7 +7242,7 @@ func (x VoteOption) Number() protoreflect.EnumNumber { // Deprecated: Use VoteOption.Descriptor instead. func (VoteOption) EnumDescriptor() ([]byte, []int) { - return file_cosmos_gov_v1_gov_proto_rawDescGZIP(), []int{0} + return file_cosmos_gov_v1_gov_proto_rawDescGZIP(), []int{1} } // ProposalStatus enumerates the valid statuses of a proposal. @@ -7103,11 +7299,11 @@ func (x ProposalStatus) String() string { } func (ProposalStatus) Descriptor() protoreflect.EnumDescriptor { - return file_cosmos_gov_v1_gov_proto_enumTypes[1].Descriptor() + return file_cosmos_gov_v1_gov_proto_enumTypes[2].Descriptor() } func (ProposalStatus) Type() protoreflect.EnumType { - return &file_cosmos_gov_v1_gov_proto_enumTypes[1] + return &file_cosmos_gov_v1_gov_proto_enumTypes[2] } func (x ProposalStatus) Number() protoreflect.EnumNumber { @@ -7116,7 +7312,7 @@ func (x ProposalStatus) Number() protoreflect.EnumNumber { // Deprecated: Use ProposalStatus.Descriptor instead. func (ProposalStatus) EnumDescriptor() ([]byte, []int) { - return file_cosmos_gov_v1_gov_proto_rawDescGZIP(), []int{1} + return file_cosmos_gov_v1_gov_proto_rawDescGZIP(), []int{2} } // WeightedVoteOption defines a unit of vote for vote split. @@ -7266,11 +7462,18 @@ type Proposal struct { // expedited defines if the proposal is expedited // // Since: cosmos-sdk 0.50 + // Deprecated: Use ProposalType instead. + // + // Deprecated: Do not use. Expedited bool `protobuf:"varint,14,opt,name=expedited,proto3" json:"expedited,omitempty"` // failed_reason defines the reason why the proposal failed // // Since: cosmos-sdk 0.50 FailedReason string `protobuf:"bytes,15,opt,name=failed_reason,json=failedReason,proto3" json:"failed_reason,omitempty"` + // proposal_type defines the type of the proposal + // + // Since: cosmos-sdk 0.51 + ProposalType ProposalType `protobuf:"varint,16,opt,name=proposal_type,json=proposalType,proto3,enum=cosmos.gov.v1.ProposalType" json:"proposal_type,omitempty"` } func (x *Proposal) Reset() { @@ -7384,6 +7587,7 @@ func (x *Proposal) GetProposer() string { return "" } +// Deprecated: Do not use. func (x *Proposal) GetExpedited() bool { if x != nil { return x.Expedited @@ -7398,6 +7602,13 @@ func (x *Proposal) GetFailedReason() string { return "" } +func (x *Proposal) GetProposalType() ProposalType { + if x != nil { + return x.ProposalType + } + return ProposalType_PROPOSAL_TYPE_UNSPECIFIED +} + // TallyResult defines a standard tally for a governance proposal. type TallyResult struct { state protoimpl.MessageState @@ -7405,13 +7616,15 @@ type TallyResult struct { unknownFields protoimpl.UnknownFields // yes_count is the number of yes votes on a proposal. - YesCount string `protobuf:"bytes,1,opt,name=yes_count,json=yesCount,proto3" json:"yes_count,omitempty"` + YesCount string `protobuf:"bytes,1,opt,name=yes_count,json=yesCount,proto3" json:"yes_count,omitempty"` // option 1 // abstain_count is the number of abstain votes on a proposal. - AbstainCount string `protobuf:"bytes,2,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` + AbstainCount string `protobuf:"bytes,2,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` // option 2 // no_count is the number of no votes on a proposal. - NoCount string `protobuf:"bytes,3,opt,name=no_count,json=noCount,proto3" json:"no_count,omitempty"` + NoCount string `protobuf:"bytes,3,opt,name=no_count,json=noCount,proto3" json:"no_count,omitempty"` // option 3 // no_with_veto_count is the number of no with veto votes on a proposal. - NoWithVetoCount string `protobuf:"bytes,4,opt,name=no_with_veto_count,json=noWithVetoCount,proto3" json:"no_with_veto_count,omitempty"` + NoWithVetoCount string `protobuf:"bytes,4,opt,name=no_with_veto_count,json=noWithVetoCount,proto3" json:"no_with_veto_count,omitempty"` // option 4 + // spam_count is the number of spam votes on a proposal. + SpamCount string `protobuf:"bytes,5,opt,name=spam_count,json=spamCount,proto3" json:"spam_count,omitempty"` } func (x *TallyResult) Reset() { @@ -7462,6 +7675,13 @@ func (x *TallyResult) GetNoWithVetoCount() string { return "" } +func (x *TallyResult) GetSpamCount() string { + if x != nil { + return x.SpamCount + } + return "" +} + // Vote defines a vote on a governance proposal. // A Vote consists of a proposal ID, the voter, and the vote option. type Vote struct { @@ -7899,7 +8119,7 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x84, 0x06, 0x0a, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xca, 0x06, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, @@ -7944,139 +8164,164 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, - 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x18, 0x0e, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x12, 0x23, - 0x0a, 0x0d, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, - 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x22, 0xd7, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x12, 0x2b, 0x0a, 0x09, 0x79, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x08, 0x79, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x33, 0x0a, 0x0d, 0x61, 0x62, 0x73, 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0c, 0x61, 0x62, 0x73, 0x74, 0x61, 0x69, 0x6e, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x08, 0x6e, 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x07, 0x6e, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x3b, 0x0a, 0x12, 0x6e, 0x6f, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x76, 0x65, 0x74, 0x6f, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, - 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0f, 0x6e, 0x6f, - 0x57, 0x69, 0x74, 0x68, 0x56, 0x65, 0x74, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb6, 0x01, - 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, - 0x64, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, 0xdd, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, 0x0b, 0x6d, 0x69, 0x6e, 0x5f, - 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x1d, 0xc8, 0xde, 0x1f, 0x00, 0xea, 0xde, - 0x1f, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x2c, 0x6f, 0x6d, - 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x12, 0x6d, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x24, 0xea, 0xde, 0x1f, 0x1c, - 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, - 0x6f, 0x64, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x98, 0xdf, 0x1f, 0x01, - 0x52, 0x10, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x65, 0x72, 0x69, - 0x6f, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x58, 0x0a, 0x0c, 0x56, 0x6f, 0x74, 0x69, 0x6e, 0x67, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, - 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x0c, - 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x3a, 0x02, 0x18, 0x01, - 0x22, 0x9e, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x26, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x12, 0x20, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x18, 0x0e, 0x20, + 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, + 0x65, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x61, + 0x73, 0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x61, 0x69, 0x6c, 0x65, + 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x86, 0x02, 0x0a, 0x0b, 0x54, 0x61, + 0x6c, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x2b, 0x0a, 0x09, 0x79, 0x65, 0x73, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x08, 0x79, 0x65, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x0d, 0x61, 0x62, 0x73, 0x74, 0x61, 0x69, + 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0c, 0x61, + 0x62, 0x73, 0x74, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x08, 0x6e, + 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x07, 0x6e, + 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x12, 0x6e, 0x6f, 0x5f, 0x77, 0x69, 0x74, + 0x68, 0x5f, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, + 0x6e, 0x74, 0x52, 0x0f, 0x6e, 0x6f, 0x57, 0x69, 0x74, 0x68, 0x56, 0x65, 0x74, 0x6f, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x2d, 0x0a, 0x0a, 0x73, 0x70, 0x61, 0x6d, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x09, 0x73, 0x70, 0x61, 0x6d, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0xb6, 0x01, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, + 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, 0xdd, 0x01, 0x0a, 0x0d, + 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, + 0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x1d, 0xc8, + 0xde, 0x1f, 0x00, 0xea, 0xde, 0x1f, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x0a, 0x6d, 0x69, + 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x6d, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, + 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, + 0x24, 0xea, 0xde, 0x1f, 0x1c, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x2c, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, + 0x79, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x58, 0x0a, 0x0c, 0x56, + 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x76, + 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, + 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, + 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x9e, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2c, 0x0a, + 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, - 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, - 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x09, 0x74, 0x68, 0x72, - 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x35, 0x0a, 0x0e, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, - 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, - 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0d, - 0x76, 0x65, 0x74, 0x6f, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x3a, 0x02, 0x18, - 0x01, 0x22, 0x8f, 0x08, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 0x0a, 0x0b, - 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, - 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x12, 0x4d, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, - 0x52, 0x10, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x65, 0x72, 0x69, - 0x6f, 0x64, 0x12, 0x44, 0x0a, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, - 0x69, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x76, 0x6f, 0x74, 0x69, - 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x71, 0x75, 0x6f, 0x72, - 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, - 0x12, 0x2c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x05, 0x20, + 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x35, 0x0a, 0x0e, 0x76, + 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x44, 0x65, 0x63, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x35, - 0x0a, 0x0e, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0d, 0x76, 0x65, 0x74, 0x6f, 0x54, 0x68, 0x72, 0x65, - 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x49, 0x0a, 0x19, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x16, 0x6d, 0x69, 0x6e, 0x49, 0x6e, 0x69, - 0x74, 0x69, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x61, 0x74, 0x69, 0x6f, - 0x12, 0x42, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x63, 0x61, 0x6e, - 0x63, 0x65, 0x6c, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, - 0x13, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, - 0x61, 0x74, 0x69, 0x6f, 0x12, 0x4a, 0x0a, 0x14, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, - 0x5f, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x12, 0x70, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x44, 0x65, 0x73, 0x74, - 0x12, 0x57, 0x0a, 0x17, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x76, 0x6f, - 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, - 0x1f, 0x01, 0x52, 0x15, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x56, 0x6f, 0x74, - 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x3f, 0x0a, 0x13, 0x65, 0x78, 0x70, - 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x12, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, - 0x64, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x58, 0x0a, 0x15, 0x65, 0x78, - 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x13, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x4d, 0x69, 0x6e, 0x44, 0x65, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x62, 0x75, 0x72, 0x6e, 0x5f, 0x76, 0x6f, 0x74, - 0x65, 0x5f, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, - 0x62, 0x75, 0x72, 0x6e, 0x56, 0x6f, 0x74, 0x65, 0x51, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x41, - 0x0a, 0x1d, 0x62, 0x75, 0x72, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, - 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x18, - 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x62, 0x75, 0x72, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, - 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x62, 0x75, 0x72, 0x6e, 0x5f, 0x76, 0x6f, 0x74, 0x65, 0x5f, 0x76, - 0x65, 0x74, 0x6f, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x62, 0x75, 0x72, 0x6e, 0x56, - 0x6f, 0x74, 0x65, 0x56, 0x65, 0x74, 0x6f, 0x12, 0x3a, 0x0a, 0x11, 0x6d, 0x69, 0x6e, 0x5f, 0x64, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x10, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, - 0x65, 0x63, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x61, - 0x74, 0x69, 0x6f, 0x2a, 0x89, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x13, 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, - 0x45, 0x53, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x12, 0x0a, + 0x44, 0x65, 0x63, 0x52, 0x0d, 0x76, 0x65, 0x74, 0x6f, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, + 0x6c, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x22, 0x8f, 0x08, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, + 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x6d, 0x69, + 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x4d, 0x0a, 0x12, 0x6d, 0x61, 0x78, 0x5f, + 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, + 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x44, 0x0a, 0x0d, 0x76, 0x6f, 0x74, 0x69, 0x6e, + 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, + 0x0c, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x26, 0x0a, + 0x06, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x71, + 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x12, 0x2c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, + 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, + 0x6f, 0x6c, 0x64, 0x12, 0x35, 0x0a, 0x0e, 0x76, 0x65, 0x74, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, + 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, + 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0d, 0x76, 0x65, 0x74, + 0x6f, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x49, 0x0a, 0x19, 0x6d, 0x69, + 0x6e, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x16, 0x6d, + 0x69, 0x6e, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x42, 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x5f, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x44, 0x65, 0x63, 0x52, 0x13, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x4a, 0x0a, 0x14, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x5f, 0x64, 0x65, 0x73, + 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x44, 0x65, 0x73, 0x74, 0x12, 0x57, 0x0a, 0x17, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, + 0x65, 0x64, 0x5f, 0x76, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x04, 0x98, 0xdf, 0x1f, 0x01, 0x52, 0x15, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, + 0x65, 0x64, 0x56, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x3f, + 0x0a, 0x13, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x68, 0x72, 0x65, + 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, + 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x12, 0x65, 0x78, 0x70, + 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, + 0x58, 0x0a, 0x15, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x69, 0x6e, + 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x13, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x4d, + 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x62, 0x75, 0x72, + 0x6e, 0x5f, 0x76, 0x6f, 0x74, 0x65, 0x5f, 0x71, 0x75, 0x6f, 0x72, 0x75, 0x6d, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0e, 0x62, 0x75, 0x72, 0x6e, 0x56, 0x6f, 0x74, 0x65, 0x51, 0x75, 0x6f, + 0x72, 0x75, 0x6d, 0x12, 0x41, 0x0a, 0x1d, 0x62, 0x75, 0x72, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x70, 0x72, 0x65, + 0x76, 0x6f, 0x74, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x62, 0x75, 0x72, 0x6e, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x50, + 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x62, 0x75, 0x72, 0x6e, 0x5f, 0x76, + 0x6f, 0x74, 0x65, 0x5f, 0x76, 0x65, 0x74, 0x6f, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, + 0x62, 0x75, 0x72, 0x6e, 0x56, 0x6f, 0x74, 0x65, 0x56, 0x65, 0x74, 0x6f, 0x12, 0x3a, 0x0a, 0x11, + 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x2a, 0xa7, 0x01, 0x0a, 0x0c, 0x50, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x52, 0x4f, + 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x50, + 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x4e, 0x44, 0x41, + 0x52, 0x44, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x50, 0x4c, 0x45, 0x5f, 0x43, + 0x48, 0x4f, 0x49, 0x43, 0x45, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x52, 0x4f, 0x50, 0x4f, + 0x53, 0x41, 0x4c, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4d, 0x49, 0x53, + 0x54, 0x49, 0x43, 0x10, 0x03, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, + 0x4c, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x50, 0x45, 0x44, 0x49, 0x54, 0x45, 0x44, + 0x10, 0x04, 0x2a, 0xfa, 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, + 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x4e, + 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, + 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x57, 0x4f, 0x10, 0x02, 0x12, 0x17, 0x0a, + 0x13, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, + 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, + 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, - 0x03, 0x12, 0x1c, 0x0a, 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x2a, + 0x03, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x46, 0x4f, 0x55, 0x52, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, + 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, + 0x45, 0x54, 0x4f, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x50, 0x41, 0x4d, 0x10, 0x05, 0x1a, 0x02, 0x10, 0x01, 0x2a, 0xce, 0x01, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x52, 0x4f, 0x50, 0x4f, 0x53, 0x41, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, @@ -8115,50 +8360,52 @@ func file_cosmos_gov_v1_gov_proto_rawDescGZIP() []byte { return file_cosmos_gov_v1_gov_proto_rawDescData } -var file_cosmos_gov_v1_gov_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_cosmos_gov_v1_gov_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_cosmos_gov_v1_gov_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_cosmos_gov_v1_gov_proto_goTypes = []interface{}{ - (VoteOption)(0), // 0: cosmos.gov.v1.VoteOption - (ProposalStatus)(0), // 1: cosmos.gov.v1.ProposalStatus - (*WeightedVoteOption)(nil), // 2: cosmos.gov.v1.WeightedVoteOption - (*Deposit)(nil), // 3: cosmos.gov.v1.Deposit - (*Proposal)(nil), // 4: cosmos.gov.v1.Proposal - (*TallyResult)(nil), // 5: cosmos.gov.v1.TallyResult - (*Vote)(nil), // 6: cosmos.gov.v1.Vote - (*DepositParams)(nil), // 7: cosmos.gov.v1.DepositParams - (*VotingParams)(nil), // 8: cosmos.gov.v1.VotingParams - (*TallyParams)(nil), // 9: cosmos.gov.v1.TallyParams - (*Params)(nil), // 10: cosmos.gov.v1.Params - (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin - (*anypb.Any)(nil), // 12: google.protobuf.Any - (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 14: google.protobuf.Duration + (ProposalType)(0), // 0: cosmos.gov.v1.ProposalType + (VoteOption)(0), // 1: cosmos.gov.v1.VoteOption + (ProposalStatus)(0), // 2: cosmos.gov.v1.ProposalStatus + (*WeightedVoteOption)(nil), // 3: cosmos.gov.v1.WeightedVoteOption + (*Deposit)(nil), // 4: cosmos.gov.v1.Deposit + (*Proposal)(nil), // 5: cosmos.gov.v1.Proposal + (*TallyResult)(nil), // 6: cosmos.gov.v1.TallyResult + (*Vote)(nil), // 7: cosmos.gov.v1.Vote + (*DepositParams)(nil), // 8: cosmos.gov.v1.DepositParams + (*VotingParams)(nil), // 9: cosmos.gov.v1.VotingParams + (*TallyParams)(nil), // 10: cosmos.gov.v1.TallyParams + (*Params)(nil), // 11: cosmos.gov.v1.Params + (*v1beta1.Coin)(nil), // 12: cosmos.base.v1beta1.Coin + (*anypb.Any)(nil), // 13: google.protobuf.Any + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 15: google.protobuf.Duration } var file_cosmos_gov_v1_gov_proto_depIdxs = []int32{ - 0, // 0: cosmos.gov.v1.WeightedVoteOption.option:type_name -> cosmos.gov.v1.VoteOption - 11, // 1: cosmos.gov.v1.Deposit.amount:type_name -> cosmos.base.v1beta1.Coin - 12, // 2: cosmos.gov.v1.Proposal.messages:type_name -> google.protobuf.Any - 1, // 3: cosmos.gov.v1.Proposal.status:type_name -> cosmos.gov.v1.ProposalStatus - 5, // 4: cosmos.gov.v1.Proposal.final_tally_result:type_name -> cosmos.gov.v1.TallyResult - 13, // 5: cosmos.gov.v1.Proposal.submit_time:type_name -> google.protobuf.Timestamp - 13, // 6: cosmos.gov.v1.Proposal.deposit_end_time:type_name -> google.protobuf.Timestamp - 11, // 7: cosmos.gov.v1.Proposal.total_deposit:type_name -> cosmos.base.v1beta1.Coin - 13, // 8: cosmos.gov.v1.Proposal.voting_start_time:type_name -> google.protobuf.Timestamp - 13, // 9: cosmos.gov.v1.Proposal.voting_end_time:type_name -> google.protobuf.Timestamp - 2, // 10: cosmos.gov.v1.Vote.options:type_name -> cosmos.gov.v1.WeightedVoteOption - 11, // 11: cosmos.gov.v1.DepositParams.min_deposit:type_name -> cosmos.base.v1beta1.Coin - 14, // 12: cosmos.gov.v1.DepositParams.max_deposit_period:type_name -> google.protobuf.Duration - 14, // 13: cosmos.gov.v1.VotingParams.voting_period:type_name -> google.protobuf.Duration - 11, // 14: cosmos.gov.v1.Params.min_deposit:type_name -> cosmos.base.v1beta1.Coin - 14, // 15: cosmos.gov.v1.Params.max_deposit_period:type_name -> google.protobuf.Duration - 14, // 16: cosmos.gov.v1.Params.voting_period:type_name -> google.protobuf.Duration - 14, // 17: cosmos.gov.v1.Params.expedited_voting_period:type_name -> google.protobuf.Duration - 11, // 18: cosmos.gov.v1.Params.expedited_min_deposit:type_name -> cosmos.base.v1beta1.Coin - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 1, // 0: cosmos.gov.v1.WeightedVoteOption.option:type_name -> cosmos.gov.v1.VoteOption + 12, // 1: cosmos.gov.v1.Deposit.amount:type_name -> cosmos.base.v1beta1.Coin + 13, // 2: cosmos.gov.v1.Proposal.messages:type_name -> google.protobuf.Any + 2, // 3: cosmos.gov.v1.Proposal.status:type_name -> cosmos.gov.v1.ProposalStatus + 6, // 4: cosmos.gov.v1.Proposal.final_tally_result:type_name -> cosmos.gov.v1.TallyResult + 14, // 5: cosmos.gov.v1.Proposal.submit_time:type_name -> google.protobuf.Timestamp + 14, // 6: cosmos.gov.v1.Proposal.deposit_end_time:type_name -> google.protobuf.Timestamp + 12, // 7: cosmos.gov.v1.Proposal.total_deposit:type_name -> cosmos.base.v1beta1.Coin + 14, // 8: cosmos.gov.v1.Proposal.voting_start_time:type_name -> google.protobuf.Timestamp + 14, // 9: cosmos.gov.v1.Proposal.voting_end_time:type_name -> google.protobuf.Timestamp + 0, // 10: cosmos.gov.v1.Proposal.proposal_type:type_name -> cosmos.gov.v1.ProposalType + 3, // 11: cosmos.gov.v1.Vote.options:type_name -> cosmos.gov.v1.WeightedVoteOption + 12, // 12: cosmos.gov.v1.DepositParams.min_deposit:type_name -> cosmos.base.v1beta1.Coin + 15, // 13: cosmos.gov.v1.DepositParams.max_deposit_period:type_name -> google.protobuf.Duration + 15, // 14: cosmos.gov.v1.VotingParams.voting_period:type_name -> google.protobuf.Duration + 12, // 15: cosmos.gov.v1.Params.min_deposit:type_name -> cosmos.base.v1beta1.Coin + 15, // 16: cosmos.gov.v1.Params.max_deposit_period:type_name -> google.protobuf.Duration + 15, // 17: cosmos.gov.v1.Params.voting_period:type_name -> google.protobuf.Duration + 15, // 18: cosmos.gov.v1.Params.expedited_voting_period:type_name -> google.protobuf.Duration + 12, // 19: cosmos.gov.v1.Params.expedited_min_deposit:type_name -> cosmos.base.v1beta1.Coin + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_cosmos_gov_v1_gov_proto_init() } @@ -8281,7 +8528,7 @@ func file_cosmos_gov_v1_gov_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_gov_v1_gov_proto_rawDesc, - NumEnums: 2, + NumEnums: 3, NumMessages: 9, NumExtensions: 0, NumServices: 0, diff --git a/api/cosmos/gov/v1/query.pulsar.go b/api/cosmos/gov/v1/query.pulsar.go index c4cd092958f7..dbf8a2df0028 100644 --- a/api/cosmos/gov/v1/query.pulsar.go +++ b/api/cosmos/gov/v1/query.pulsar.go @@ -9160,7 +9160,7 @@ type QueryParamsResponse struct { // // Deprecated: Do not use. TallyParams *TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` - // params defines all the paramaters of x/gov module. + // params defines all the parameters of x/gov module. // // Since: cosmos-sdk 0.47 Params *Params `protobuf:"bytes,4,opt,name=params,proto3" json:"params,omitempty"` diff --git a/api/cosmos/gov/v1/tx.pulsar.go b/api/cosmos/gov/v1/tx.pulsar.go index 1f4fd832f946..89d043090cbf 100644 --- a/api/cosmos/gov/v1/tx.pulsar.go +++ b/api/cosmos/gov/v1/tx.pulsar.go @@ -130,6 +130,7 @@ var ( fd_MsgSubmitProposal_title protoreflect.FieldDescriptor fd_MsgSubmitProposal_summary protoreflect.FieldDescriptor fd_MsgSubmitProposal_expedited protoreflect.FieldDescriptor + fd_MsgSubmitProposal_proposal_type protoreflect.FieldDescriptor ) func init() { @@ -142,6 +143,7 @@ func init() { fd_MsgSubmitProposal_title = md_MsgSubmitProposal.Fields().ByName("title") fd_MsgSubmitProposal_summary = md_MsgSubmitProposal.Fields().ByName("summary") fd_MsgSubmitProposal_expedited = md_MsgSubmitProposal.Fields().ByName("expedited") + fd_MsgSubmitProposal_proposal_type = md_MsgSubmitProposal.Fields().ByName("proposal_type") } var _ protoreflect.Message = (*fastReflection_MsgSubmitProposal)(nil) @@ -251,6 +253,12 @@ func (x *fastReflection_MsgSubmitProposal) Range(f func(protoreflect.FieldDescri return } } + if x.ProposalType != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.ProposalType)) + if !f(fd_MsgSubmitProposal_proposal_type, value) { + return + } + } } // Has reports whether a field is populated. @@ -280,6 +288,8 @@ func (x *fastReflection_MsgSubmitProposal) Has(fd protoreflect.FieldDescriptor) return x.Summary != "" case "cosmos.gov.v1.MsgSubmitProposal.expedited": return x.Expedited != false + case "cosmos.gov.v1.MsgSubmitProposal.proposal_type": + return x.ProposalType != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -310,6 +320,8 @@ func (x *fastReflection_MsgSubmitProposal) Clear(fd protoreflect.FieldDescriptor x.Summary = "" case "cosmos.gov.v1.MsgSubmitProposal.expedited": x.Expedited = false + case "cosmos.gov.v1.MsgSubmitProposal.proposal_type": + x.ProposalType = 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -353,6 +365,9 @@ func (x *fastReflection_MsgSubmitProposal) Get(descriptor protoreflect.FieldDesc case "cosmos.gov.v1.MsgSubmitProposal.expedited": value := x.Expedited return protoreflect.ValueOfBool(value) + case "cosmos.gov.v1.MsgSubmitProposal.proposal_type": + value := x.ProposalType + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -391,6 +406,8 @@ func (x *fastReflection_MsgSubmitProposal) Set(fd protoreflect.FieldDescriptor, x.Summary = value.Interface().(string) case "cosmos.gov.v1.MsgSubmitProposal.expedited": x.Expedited = value.Bool() + case "cosmos.gov.v1.MsgSubmitProposal.proposal_type": + x.ProposalType = (ProposalType)(value.Enum()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -433,6 +450,8 @@ func (x *fastReflection_MsgSubmitProposal) Mutable(fd protoreflect.FieldDescript panic(fmt.Errorf("field summary of message cosmos.gov.v1.MsgSubmitProposal is not mutable")) case "cosmos.gov.v1.MsgSubmitProposal.expedited": panic(fmt.Errorf("field expedited of message cosmos.gov.v1.MsgSubmitProposal is not mutable")) + case "cosmos.gov.v1.MsgSubmitProposal.proposal_type": + panic(fmt.Errorf("field proposal_type of message cosmos.gov.v1.MsgSubmitProposal is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -462,6 +481,8 @@ func (x *fastReflection_MsgSubmitProposal) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfString("") case "cosmos.gov.v1.MsgSubmitProposal.expedited": return protoreflect.ValueOfBool(false) + case "cosmos.gov.v1.MsgSubmitProposal.proposal_type": + return protoreflect.ValueOfEnum(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgSubmitProposal")) @@ -562,6 +583,9 @@ func (x *fastReflection_MsgSubmitProposal) ProtoMethods() *protoiface.Methods { if x.Expedited { n += 2 } + if x.ProposalType != 0 { + n += 1 + runtime.Sov(uint64(x.ProposalType)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -591,6 +615,11 @@ func (x *fastReflection_MsgSubmitProposal) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.ProposalType != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ProposalType)) + i-- + dAtA[i] = 0x40 + } if x.Expedited { i-- if x.Expedited { @@ -926,6 +955,25 @@ func (x *fastReflection_MsgSubmitProposal) ProtoMethods() *protoiface.Methods { } } x.Expedited = bool(v != 0) + case 8: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProposalType", wireType) + } + x.ProposalType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.ProposalType |= ProposalType(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -7039,7 +7087,17 @@ type MsgSubmitProposal struct { // expedited defines if the proposal is expedited or not // // Since: cosmos-sdk 0.50 + // Deprecated: Use the PROPOSAL_TYPE_EXPEDITED proposal type instead. + // When this field is set and no proposal_type is set, the proposal_type + // will be set to PROPOSAL_TYPE_EXPEDITED for backwards compatibility. + // + // Deprecated: Do not use. Expedited bool `protobuf:"varint,7,opt,name=expedited,proto3" json:"expedited,omitempty"` + // proposal_type defines the type of proposal + // When not set defaults to PROPOSAL_TYPE_STANDARD + // + // Since: cosmos-sdk 0.51 + ProposalType ProposalType `protobuf:"varint,8,opt,name=proposal_type,json=proposalType,proto3,enum=cosmos.gov.v1.ProposalType" json:"proposal_type,omitempty"` } func (x *MsgSubmitProposal) Reset() { @@ -7104,6 +7162,7 @@ func (x *MsgSubmitProposal) GetSummary() string { return "" } +// Deprecated: Do not use. func (x *MsgSubmitProposal) GetExpedited() bool { if x != nil { return x.Expedited @@ -7111,6 +7170,13 @@ func (x *MsgSubmitProposal) GetExpedited() bool { return false } +func (x *MsgSubmitProposal) GetProposalType() ProposalType { + if x != nil { + return x.ProposalType + } + return ProposalType_PROPOSAL_TYPE_UNSPECIFIED +} + // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. type MsgSubmitProposalResponse struct { state protoimpl.MessageState @@ -7690,7 +7756,7 @@ var file_cosmos_gov_v1_tx_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x03, 0x0a, 0x11, 0x4d, 0x73, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xeb, 0x03, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, @@ -7712,162 +7778,167 @@ var file_cosmos_gov_v1_tx_proto_rawDesc = []byte{ 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, - 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x3a, 0x31, - 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x8a, 0xe7, 0xb0, - 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, - 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, - 0x6c, 0x22, 0x3c, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, - 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x22, - 0xbb, 0x01, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, - 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, - 0x1e, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, - 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x1e, 0x0a, - 0x1c, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe5, 0x01, - 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x14, - 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, - 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, - 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, - 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, - 0x24, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x15, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, - 0x67, 0x56, 0x6f, 0x74, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xff, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, - 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x0b, - 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, - 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, - 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, - 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, - 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x56, 0x6f, 0x74, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x2c, 0x82, 0xe7, - 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1d, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x56, 0x6f, - 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, - 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe6, 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, - 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x64, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, - 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x6f, 0x72, 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, - 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x3a, 0x2b, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, - 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, - 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x22, 0x14, - 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, - 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x12, 0x38, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, - 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0x82, 0xe7, 0xb0, 0x2a, - 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x67, 0x6f, 0x76, 0x2f, - 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8a, 0x01, - 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x3a, 0x0d, 0x82, 0xe7, 0xb0, - 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x22, 0xc1, 0x01, 0x0a, 0x19, 0x4d, - 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, - 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, - 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, - 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x0d, 0x63, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, - 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, - 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, - 0x64, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, - 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x32, 0xe8, - 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, - 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, + 0x12, 0x20, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, + 0x65, 0x64, 0x12, 0x40, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x54, 0x79, 0x70, 0x65, 0x3a, 0x31, 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, + 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x22, 0x3c, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x11, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, - 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, - 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x1a, 0x2b, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x49, 0x64, 0x22, 0xbb, 0x01, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, + 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4e, + 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x1e, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1c, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x35, 0x82, 0xe7, + 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, + 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x04, 0x56, - 0x6f, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, - 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x56, - 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, - 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x1a, 0x26, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, - 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x19, + 0x65, 0x6e, 0x74, 0x22, 0x1e, 0x0a, 0x1c, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0xe5, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x12, + 0x35, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x61, 0x6c, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x24, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, + 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xff, + 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x65, 0x64, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x65, 0x64, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x3a, 0x2c, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x8a, 0xe7, + 0xb0, 0x2a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, + 0x2f, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, + 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe6, 0x01, 0x0a, 0x0a, + 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, + 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, + 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, + 0x64, 0x12, 0x36, 0x0a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, + 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x2b, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x0f, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x38, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, + 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x3a, 0x36, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, + 0x78, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, + 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, + 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, + 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, + 0x72, 0x3a, 0x0d, 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, + 0x22, 0xc1, 0x01, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, + 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, + 0x12, 0x49, 0x0a, 0x0d, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x63, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x63, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x48, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x32, 0xe8, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0e, + 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x63, + 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x11, 0x45, 0x78, + 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, + 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, + 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3e, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, + 0x65, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, + 0x64, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, + 0x64, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x07, 0x44, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x12, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, + 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0e, 0x43, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, - 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x98, 0x01, 0x0a, 0x11, 0x63, 0x6f, - 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x42, - 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, - 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, - 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, + 0x98, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, + 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, + 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -7900,39 +7971,41 @@ var file_cosmos_gov_v1_tx_proto_goTypes = []interface{}{ (*MsgCancelProposalResponse)(nil), // 13: cosmos.gov.v1.MsgCancelProposalResponse (*anypb.Any)(nil), // 14: google.protobuf.Any (*v1beta1.Coin)(nil), // 15: cosmos.base.v1beta1.Coin - (VoteOption)(0), // 16: cosmos.gov.v1.VoteOption - (*WeightedVoteOption)(nil), // 17: cosmos.gov.v1.WeightedVoteOption - (*Params)(nil), // 18: cosmos.gov.v1.Params - (*timestamppb.Timestamp)(nil), // 19: google.protobuf.Timestamp + (ProposalType)(0), // 16: cosmos.gov.v1.ProposalType + (VoteOption)(0), // 17: cosmos.gov.v1.VoteOption + (*WeightedVoteOption)(nil), // 18: cosmos.gov.v1.WeightedVoteOption + (*Params)(nil), // 19: cosmos.gov.v1.Params + (*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp } var file_cosmos_gov_v1_tx_proto_depIdxs = []int32{ 14, // 0: cosmos.gov.v1.MsgSubmitProposal.messages:type_name -> google.protobuf.Any 15, // 1: cosmos.gov.v1.MsgSubmitProposal.initial_deposit:type_name -> cosmos.base.v1beta1.Coin - 14, // 2: cosmos.gov.v1.MsgExecLegacyContent.content:type_name -> google.protobuf.Any - 16, // 3: cosmos.gov.v1.MsgVote.option:type_name -> cosmos.gov.v1.VoteOption - 17, // 4: cosmos.gov.v1.MsgVoteWeighted.options:type_name -> cosmos.gov.v1.WeightedVoteOption - 15, // 5: cosmos.gov.v1.MsgDeposit.amount:type_name -> cosmos.base.v1beta1.Coin - 18, // 6: cosmos.gov.v1.MsgUpdateParams.params:type_name -> cosmos.gov.v1.Params - 19, // 7: cosmos.gov.v1.MsgCancelProposalResponse.canceled_time:type_name -> google.protobuf.Timestamp - 0, // 8: cosmos.gov.v1.Msg.SubmitProposal:input_type -> cosmos.gov.v1.MsgSubmitProposal - 2, // 9: cosmos.gov.v1.Msg.ExecLegacyContent:input_type -> cosmos.gov.v1.MsgExecLegacyContent - 4, // 10: cosmos.gov.v1.Msg.Vote:input_type -> cosmos.gov.v1.MsgVote - 6, // 11: cosmos.gov.v1.Msg.VoteWeighted:input_type -> cosmos.gov.v1.MsgVoteWeighted - 8, // 12: cosmos.gov.v1.Msg.Deposit:input_type -> cosmos.gov.v1.MsgDeposit - 10, // 13: cosmos.gov.v1.Msg.UpdateParams:input_type -> cosmos.gov.v1.MsgUpdateParams - 12, // 14: cosmos.gov.v1.Msg.CancelProposal:input_type -> cosmos.gov.v1.MsgCancelProposal - 1, // 15: cosmos.gov.v1.Msg.SubmitProposal:output_type -> cosmos.gov.v1.MsgSubmitProposalResponse - 3, // 16: cosmos.gov.v1.Msg.ExecLegacyContent:output_type -> cosmos.gov.v1.MsgExecLegacyContentResponse - 5, // 17: cosmos.gov.v1.Msg.Vote:output_type -> cosmos.gov.v1.MsgVoteResponse - 7, // 18: cosmos.gov.v1.Msg.VoteWeighted:output_type -> cosmos.gov.v1.MsgVoteWeightedResponse - 9, // 19: cosmos.gov.v1.Msg.Deposit:output_type -> cosmos.gov.v1.MsgDepositResponse - 11, // 20: cosmos.gov.v1.Msg.UpdateParams:output_type -> cosmos.gov.v1.MsgUpdateParamsResponse - 13, // 21: cosmos.gov.v1.Msg.CancelProposal:output_type -> cosmos.gov.v1.MsgCancelProposalResponse - 15, // [15:22] is the sub-list for method output_type - 8, // [8:15] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 16, // 2: cosmos.gov.v1.MsgSubmitProposal.proposal_type:type_name -> cosmos.gov.v1.ProposalType + 14, // 3: cosmos.gov.v1.MsgExecLegacyContent.content:type_name -> google.protobuf.Any + 17, // 4: cosmos.gov.v1.MsgVote.option:type_name -> cosmos.gov.v1.VoteOption + 18, // 5: cosmos.gov.v1.MsgVoteWeighted.options:type_name -> cosmos.gov.v1.WeightedVoteOption + 15, // 6: cosmos.gov.v1.MsgDeposit.amount:type_name -> cosmos.base.v1beta1.Coin + 19, // 7: cosmos.gov.v1.MsgUpdateParams.params:type_name -> cosmos.gov.v1.Params + 20, // 8: cosmos.gov.v1.MsgCancelProposalResponse.canceled_time:type_name -> google.protobuf.Timestamp + 0, // 9: cosmos.gov.v1.Msg.SubmitProposal:input_type -> cosmos.gov.v1.MsgSubmitProposal + 2, // 10: cosmos.gov.v1.Msg.ExecLegacyContent:input_type -> cosmos.gov.v1.MsgExecLegacyContent + 4, // 11: cosmos.gov.v1.Msg.Vote:input_type -> cosmos.gov.v1.MsgVote + 6, // 12: cosmos.gov.v1.Msg.VoteWeighted:input_type -> cosmos.gov.v1.MsgVoteWeighted + 8, // 13: cosmos.gov.v1.Msg.Deposit:input_type -> cosmos.gov.v1.MsgDeposit + 10, // 14: cosmos.gov.v1.Msg.UpdateParams:input_type -> cosmos.gov.v1.MsgUpdateParams + 12, // 15: cosmos.gov.v1.Msg.CancelProposal:input_type -> cosmos.gov.v1.MsgCancelProposal + 1, // 16: cosmos.gov.v1.Msg.SubmitProposal:output_type -> cosmos.gov.v1.MsgSubmitProposalResponse + 3, // 17: cosmos.gov.v1.Msg.ExecLegacyContent:output_type -> cosmos.gov.v1.MsgExecLegacyContentResponse + 5, // 18: cosmos.gov.v1.Msg.Vote:output_type -> cosmos.gov.v1.MsgVoteResponse + 7, // 19: cosmos.gov.v1.Msg.VoteWeighted:output_type -> cosmos.gov.v1.MsgVoteWeightedResponse + 9, // 20: cosmos.gov.v1.Msg.Deposit:output_type -> cosmos.gov.v1.MsgDepositResponse + 11, // 21: cosmos.gov.v1.Msg.UpdateParams:output_type -> cosmos.gov.v1.MsgUpdateParamsResponse + 13, // 22: cosmos.gov.v1.Msg.CancelProposal:output_type -> cosmos.gov.v1.MsgCancelProposalResponse + 16, // [16:23] is the sub-list for method output_type + 9, // [9:16] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_cosmos_gov_v1_tx_proto_init() } diff --git a/api/cosmos/msg/textual/v1/textual.pulsar.go b/api/cosmos/msg/textual/v1/textual.pulsar.go index 6c9921937ab2..702d737a7485 100644 --- a/api/cosmos/msg/textual/v1/textual.pulsar.go +++ b/api/cosmos/msg/textual/v1/textual.pulsar.go @@ -38,7 +38,7 @@ var ( // algorithm used to generate the custom textual representation of the // protobuf message where this annotation is applied. We recommend to use a // short, versioned name as this identifier, e.g. "replace_with_username_v1". - // We also recommand providing a human-readable description as protobuf + // We also recommend providing a human-readable description as protobuf // comments on this annotation, for example a short specification or a link // to the relevant documentation. // diff --git a/api/cosmos/staking/v1beta1/staking.pulsar.go b/api/cosmos/staking/v1beta1/staking.pulsar.go index 7fe0fec480ff..296dca5ad9fb 100644 --- a/api/cosmos/staking/v1beta1/staking.pulsar.go +++ b/api/cosmos/staking/v1beta1/staking.pulsar.go @@ -14953,7 +14953,7 @@ type Validator struct { MinSelfDelegation string `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3" json:"min_self_delegation,omitempty"` // strictly positive if this validator's unbonding has been stopped by external modules UnbondingOnHoldRefCount int64 `protobuf:"varint,12,opt,name=unbonding_on_hold_ref_count,json=unbondingOnHoldRefCount,proto3" json:"unbonding_on_hold_ref_count,omitempty"` - // list of unbonding ids, each uniquely identifing an unbonding of this validator + // list of unbonding ids, each uniquely identifying an unbonding of this validator UnbondingIds []uint64 `protobuf:"varint,13,rep,packed,name=unbonding_ids,json=unbondingIds,proto3" json:"unbonding_ids,omitempty"` } @@ -15942,7 +15942,7 @@ type ConsPubKeyRotationHistory struct { OldConsPubkey *anypb.Any `protobuf:"bytes,2,opt,name=old_cons_pubkey,json=oldConsPubkey,proto3" json:"old_cons_pubkey,omitempty"` // new_cons_pubkey is the new consensus public key of the validator, as a Protobuf Any. NewConsPubkey *anypb.Any `protobuf:"bytes,3,opt,name=new_cons_pubkey,json=newConsPubkey,proto3" json:"new_cons_pubkey,omitempty"` - // height defines the block height at which the rotation event occured. + // height defines the block height at which the rotation event occurred. Height uint64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` // fee holds the amount of fee deduced for the rotation. Fee *v1beta1.Coin `protobuf:"bytes,5,opt,name=fee,proto3" json:"fee,omitempty"` diff --git a/api/tendermint/abci/types.pulsar.go b/api/tendermint/abci/types.pulsar.go index bfdc98d0bf7b..a83a7db54693 100644 --- a/api/tendermint/abci/types.pulsar.go +++ b/api/tendermint/abci/types.pulsar.go @@ -33273,7 +33273,7 @@ type ResponseFinalizeBlock struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // set of block events emmitted as part of executing the block + // set of block events emitted as part of executing the block Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` // the result of executing each transaction including the events // the particular transction emitted. This should match the order diff --git a/api/tendermint/crypto/proof.pulsar.go b/api/tendermint/crypto/proof.pulsar.go index a3128844e44e..dfaf424608db 100644 --- a/api/tendermint/crypto/proof.pulsar.go +++ b/api/tendermint/crypto/proof.pulsar.go @@ -2919,7 +2919,7 @@ func (x *DominoOp) GetOutput() string { } // ProofOp defines an operation used for calculating Merkle root -// The data could be arbitrary format, providing nessecary data +// The data could be arbitrary format, providing necessary data // for example neighbouring node hash type ProofOp struct { state protoimpl.MessageState diff --git a/baseapp/abci.go b/baseapp/abci.go index 2934fba871f7..18d12c3ff278 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -889,7 +889,7 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons return res, err } -// checkHalt checkes if height or time exceeds halt-height or halt-time respectively. +// checkHalt checks if height or time exceeds halt-height or halt-time respectively. func (app *BaseApp) checkHalt(height int64, time time.Time) error { var halt bool switch { diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 7fea57304593..87cd2294c185 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -153,7 +153,7 @@ type BaseApp struct { // ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates // that no blocks should be pruned. // - // Note: CometBFT block pruning is dependant on this parameter in conjunction + // Note: CometBFT block pruning is dependent on this parameter in conjunction // with the unbonding (safety threshold) period, state pruning and state sync // snapshot parameters to determine the correct minimum value of // ResponseCommit.RetainHeight. @@ -938,24 +938,25 @@ func (app *BaseApp) runTx(mode execMode, txBytes []byte) (gInfo sdk.GasInfo, res if err == nil { result, err = app.runMsgs(runMsgCtx, msgs, msgsV2, mode) } - if err == nil { - // Run optional postHandlers. - // - // Note: If the postHandler fails, we also revert the runMsgs state. - if app.postHandler != nil { - // The runMsgCtx context currently contains events emitted by the ante handler. - // We clear this to correctly order events without duplicates. - // Note that the state is still preserved. - postCtx := runMsgCtx.WithEventManager(sdk.NewEventManager()) - - newCtx, err := app.postHandler(postCtx, tx, mode == execModeSimulate, err == nil) - if err != nil { - return gInfo, nil, anteEvents, err - } - result.Events = append(result.Events, newCtx.EventManager().ABCIEvents()...) + // Run optional postHandlers (should run regardless of the execution result). + // + // Note: If the postHandler fails, we also revert the runMsgs state. + if app.postHandler != nil { + // The runMsgCtx context currently contains events emitted by the ante handler. + // We clear this to correctly order events without duplicates. + // Note that the state is still preserved. + postCtx := runMsgCtx.WithEventManager(sdk.NewEventManager()) + + newCtx, err := app.postHandler(postCtx, tx, mode == execModeSimulate, err == nil) + if err != nil { + return gInfo, nil, anteEvents, err } + result.Events = append(result.Events, newCtx.EventManager().ABCIEvents()...) + } + + if err == nil { if mode == execModeFinalize { // When block gas exceeds, it'll panic and won't commit the cached store. consumeBlockGas() diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index c769f773c3d2..67141a5e3002 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -594,6 +594,53 @@ func TestBaseAppAnteHandler(t *testing.T) { require.NoError(t, err) } +func TestBaseAppPostHandler(t *testing.T) { + postHandlerRun := false + anteOpt := func(bapp *baseapp.BaseApp) { + bapp.SetPostHandler(func(ctx sdk.Context, tx sdk.Tx, simulate, success bool) (newCtx sdk.Context, err error) { + postHandlerRun = true + return ctx, nil + }) + } + + suite := NewBaseAppSuite(t, anteOpt) + + baseapptestutil.RegisterCounterServer(suite.baseApp.MsgServiceRouter(), CounterServerImpl{t, capKey1, []byte("foo")}) + + _, err := suite.baseApp.InitChain(&abci.RequestInitChain{ + ConsensusParams: &cmtproto.ConsensusParams{}, + }) + require.NoError(t, err) + + // execute a tx that will fail ante handler execution + // + // NOTE: State should not be mutated here. This will be implicitly checked by + // the next txs ante handler execution (anteHandlerTxTest). + tx := newTxCounter(t, suite.txConfig, 0, 0) + txBytes, err := suite.txConfig.TxEncoder()(tx) + require.NoError(t, err) + + res, err := suite.baseApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1, Txs: [][]byte{txBytes}}) + require.NoError(t, err) + require.Empty(t, res.Events) + require.True(t, res.TxResults[0].IsOK(), fmt.Sprintf("%v", res)) + + // PostHandler runs on successful message execution + require.True(t, postHandlerRun) + + // It should also run on failed message execution + postHandlerRun = false + tx = setFailOnHandler(t, suite.txConfig, tx, true) + txBytes, err = suite.txConfig.TxEncoder()(tx) + require.NoError(t, err) + res, err = suite.baseApp.FinalizeBlock(&abci.RequestFinalizeBlock{Height: 1, Txs: [][]byte{txBytes}}) + require.NoError(t, err) + require.Empty(t, res.Events) + require.False(t, res.TxResults[0].IsOK(), fmt.Sprintf("%v", res)) + + require.True(t, postHandlerRun) +} + // Test and ensure that invalid block heights always cause errors. // See issues: // - https://github.com/cosmos/cosmos-sdk/issues/11220 diff --git a/baseapp/internal/protocompat/protocompat.go b/baseapp/internal/protocompat/protocompat.go index 8e85ea6cede0..4bd24f6c2ff2 100644 --- a/baseapp/internal/protocompat/protocompat.go +++ b/baseapp/internal/protocompat/protocompat.go @@ -6,6 +6,7 @@ import ( "reflect" gogoproto "github.com/cosmos/gogoproto/proto" + "github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. "google.golang.org/grpc" proto2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -125,14 +126,18 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B } resp, err := method.Handler(handler, ctx, func(msg any) error { // merge! ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(msg.(gogoproto.Message), inReq) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(msg.(gogoproto.Message), inReq) return nil }, nil) if err != nil { return err } // merge resp, ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) return nil }, nil } @@ -165,14 +170,19 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B // we can just call the handler after making a copy of the message, for safety reasons. resp, err := method.Handler(handler, ctx, func(msg any) error { // ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(msg.(gogoproto.Message), m) + asGogoProto := msg.(gogoproto.Message) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(asGogoProto, m) return nil }, nil) if err != nil { return err } // merge on the resp, ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) return nil default: panic("unreachable") diff --git a/client/config/config_test.go b/client/config/config_test.go index 7eea0a791518..ceb052e8acd5 100644 --- a/client/config/config_test.go +++ b/client/config/config_test.go @@ -82,7 +82,7 @@ func TestCustomTemplateAndConfig(t *testing.T) { customClientConfigTemplate := config.DefaultClientConfigTemplate + ` # This is the gas adjustment factor used by the tx commands. -# Sets the default and can be overwriten by the --gas-adjustment flag in tx commands. +# Sets the default and can be overwritten by the --gas-adjustment flag in tx commands. gas-adjustment = {{ .GasConfig.GasAdjustment }} # Memo to include in all transactions. note = "{{ .Note }}" diff --git a/client/debug/main.go b/client/debug/main.go index 508ab43e3bbb..5d10e45cf184 100644 --- a/client/debug/main.go +++ b/client/debug/main.go @@ -79,7 +79,7 @@ func getCodecInterfaces() *cobra.Command { } } -// getCodecInterfaceImpls creates and returns a new cmd used for listing all registered implemenations of a given interface on the application codec. +// getCodecInterfaceImpls creates and returns a new cmd used for listing all registered implementations of a given interface on the application codec. func getCodecInterfaceImpls() *cobra.Command { return &cobra.Command{ Use: "list-implementations [interface]", diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 7ffcaf9ffa90..b60f2c0f4466 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -14171,7 +14171,7 @@ paths: vetoed. Default value: 1/3. params: description: |- - params defines all the paramaters of x/gov module. + params defines all the parameters of x/gov module. Since: cosmos-sdk 0.47 type: object @@ -19195,7 +19195,7 @@ paths: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total @@ -19819,7 +19819,7 @@ paths: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount @@ -20458,7 +20458,7 @@ paths: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total @@ -21517,7 +21517,7 @@ paths: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total @@ -22139,7 +22139,7 @@ paths: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount @@ -51844,7 +51844,7 @@ definitions: vetoed. Default value: 1/3. params: description: |- - params defines all the paramaters of x/gov module. + params defines all the parameters of x/gov module. Since: cosmos-sdk 0.47 type: object @@ -53712,7 +53712,7 @@ definitions: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an unbonding of + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount of the @@ -54309,7 +54309,7 @@ definitions: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an unbonding of + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount of the @@ -54631,7 +54631,7 @@ definitions: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an unbonding of + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount of the @@ -55060,7 +55060,7 @@ definitions: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an unbonding + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount of @@ -55747,7 +55747,7 @@ definitions: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an unbonding of + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount of the @@ -56145,7 +56145,7 @@ definitions: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an unbonding of + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount of the @@ -56813,7 +56813,7 @@ definitions: type: string format: uint64 title: >- - list of unbonding ids, each uniquely identifing an unbonding of this + list of unbonding ids, each uniquely identifying an unbonding of this validator description: >- Validator defines a validator, together with the total amount of the diff --git a/client/input/input_test.go b/client/input/input_test.go index 3132afcdfaa4..f28a9c3905a0 100644 --- a/client/input/input_test.go +++ b/client/input/input_test.go @@ -43,7 +43,7 @@ func TestReadLineFromBuf(t *testing.T) { require.ErrorIs(t, err, io.EOF) }) - t.Run("it returns the error if it's not EOF regardles if it read something or not", func(t *testing.T) { + t.Run("it returns the error if it's not EOF regardless if it read something or not", func(t *testing.T) { expectedErr := errors.New("oh no") fr.fnc = func(p []byte) (int, error) { return copy(p, []byte("hello")), expectedErr diff --git a/client/keys/add.go b/client/keys/add.go index d738d93aaa11..527209c918ea 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -20,6 +20,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -35,6 +36,7 @@ const ( flagNoSort = "nosort" flagHDPath = "hd-path" flagPubKeyBase64 = "pubkey-base64" + flagIndiscreet = "indiscreet" // DefaultKeyPass contains the default key password for genesis transactions DefaultKeyPass = "12345678" @@ -83,6 +85,7 @@ Example: f.Uint32(flagAccount, 0, "Account number for HD derivation (less than equal 2147483647)") f.Uint32(flagIndex, 0, "Address index number for HD derivation (less than equal 2147483647)") f.String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") + f.Bool(flagIndiscreet, false, "Print seed phrase directly on current terminal (only valid when --no-backup is false)") // support old flags name for backwards compatibility f.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { @@ -121,8 +124,6 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf name := args[0] interactive, _ := cmd.Flags().GetBool(flagInteractive) - noBackup, _ := cmd.Flags().GetBool(flagNoBackup) - showMnemonic := !noBackup kb := ctx.Keyring outputFormat := ctx.OutputFormat @@ -188,7 +189,7 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf return err } - return printCreate(ctx, cmd, k, false, "", outputFormat) + return printCreate(ctx, cmd, k, false, false, "", outputFormat) } } @@ -208,7 +209,7 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf return err } - return printCreate(ctx, cmd, k, false, "", outputFormat) + return printCreate(ctx, cmd, k, false, false, "", outputFormat) } if pubKeyBase64 != "" { b64, err := base64.StdEncoding.DecodeString(pubKeyBase64) @@ -217,8 +218,9 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf } var pk cryptotypes.PubKey - // create an empty pubkey in order to get the algo TypeUrl. - tempAny, err := codectypes.NewAnyWithValue(algo.Generate()([]byte{}).PubKey()) + + // create an empty seckp256k1 pubkey since it is the key returned by algo Generate function. + enotySecpPubKey, err := codectypes.NewAnyWithValue(&secp256k1.PubKey{}) if err != nil { return err } @@ -226,7 +228,7 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf jsonPub, err := json.Marshal(struct { Type string `json:"@type,omitempty"` Key string `json:"key,omitempty"` - }{tempAny.TypeUrl, string(b64)}) + }{enotySecpPubKey.TypeUrl, string(b64)}) if err != nil { return fmt.Errorf("failed to JSON marshal typeURL and base64 key: %w", err) } @@ -240,7 +242,7 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf return fmt.Errorf("failed to save offline key: %w", err) } - return printCreate(ctx, cmd, k, false, "", outputFormat) + return printCreate(ctx, cmd, k, false, false, "", outputFormat) } coinType, _ := cmd.Flags().GetUint32(flagCoinType) @@ -263,7 +265,7 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf return err } - return printCreate(ctx, cmd, k, false, "", outputFormat) + return printCreate(ctx, cmd, k, false, false, "", outputFormat) } // Get bip39 mnemonic @@ -329,18 +331,22 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf if err != nil { return err } + noBackup, _ := cmd.Flags().GetBool(flagNoBackup) + showMnemonic := !noBackup + showMnemonicIndiscreetly, _ := cmd.Flags().GetBool(flagIndiscreet) // Recover key from seed passphrase if recoverFlag { // Hide mnemonic from output showMnemonic = false + showMnemonicIndiscreetly = false mnemonic = "" } - return printCreate(ctx, cmd, k, showMnemonic, mnemonic, outputFormat) + return printCreate(ctx, cmd, k, showMnemonic, showMnemonicIndiscreetly, mnemonic, outputFormat) } -func printCreate(ctx client.Context, cmd *cobra.Command, k *keyring.Record, showMnemonic bool, mnemonic, outputFormat string) error { +func printCreate(ctx client.Context, cmd *cobra.Command, k *keyring.Record, showMnemonic, showMnemonicIndiscreetly bool, mnemonic, outputFormat string) error { switch outputFormat { case flags.OutputFormatText: cmd.PrintErrln() @@ -355,8 +361,14 @@ func printCreate(ctx client.Context, cmd *cobra.Command, k *keyring.Record, show // print mnemonic unless requested not to. if showMnemonic { - if _, err := fmt.Fprintf(cmd.ErrOrStderr(), "\n**Important** write this mnemonic phrase in a safe place.\nIt is the only way to recover your account if you ever forget your password.\n\n%s\n", mnemonic); err != nil { - return fmt.Errorf("failed to print mnemonic: %w", err) + if showMnemonicIndiscreetly { + if _, err = fmt.Fprintf(cmd.ErrOrStderr(), "\n**Important** write this mnemonic phrase in a safe place.\nIt is the only way to recover your account if you ever forget your password.\n\n%s\n", mnemonic); err != nil { + return fmt.Errorf("failed to print mnemonic: %w", err) + } + } else { + if err = printDiscreetly(ctx, cmd.ErrOrStderr(), "**Important** write this mnemonic phrase in a safe place.\nIt is the only way to recover your account if you ever forget your password.", mnemonic); err != nil { + return fmt.Errorf("failed to print mnemonic: %w", err) + } } } case flags.OutputFormatJSON: diff --git a/client/keys/export.go b/client/keys/export.go index 7e2f7250d38f..0afe6db84133 100644 --- a/client/keys/export.go +++ b/client/keys/export.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/input" - "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/types" ) @@ -42,7 +41,7 @@ and export your keys in ASCII-armored encrypted format.`, unsafe, _ := cmd.Flags().GetBool(flagUnsafe) if unarmored && unsafe { - return exportUnsafeUnarmored(cmd, args[0], buf, clientCtx.Keyring) + return exportUnsafeUnarmored(clientCtx, cmd, args[0], buf) } else if unarmored || unsafe { return fmt.Errorf("the flags %s and %s must be used together", flagUnsafe, flagUnarmoredHex) } @@ -65,25 +64,31 @@ and export your keys in ASCII-armored encrypted format.`, cmd.Flags().Bool(flagUnarmoredHex, false, "Export unarmored hex privkey. Requires --unsafe.") cmd.Flags().Bool(flagUnsafe, false, "Enable unsafe operations. This flag must be switched on along with all unsafe operation-specific options.") + cmd.Flags().Bool(flagIndiscreet, false, "Print unarmored hex privkey directly on current terminal (only valid when --unarmored-hex is true)") return cmd } -func exportUnsafeUnarmored(cmd *cobra.Command, uid string, buf *bufio.Reader, kr keyring.Keyring) error { - // confirm deletion, unless -y is passed +func exportUnsafeUnarmored(ctx client.Context, cmd *cobra.Command, uid string, buf *bufio.Reader) error { if yes, err := input.GetConfirmation("WARNING: The private key will be exported as an unarmored hexadecimal string. USE AT YOUR OWN RISK. Continue?", buf, cmd.ErrOrStderr()); err != nil { return err } else if !yes { return nil } - hexPrivKey, err := unsafeExportPrivKeyHex(kr.(unsafeExporter), uid) + hexPrivKey, err := unsafeExportPrivKeyHex(ctx.Keyring.(unsafeExporter), uid) if err != nil { return err } - - cmd.Println(hexPrivKey) - + indiscreet, _ := cmd.Flags().GetBool(flagIndiscreet) + if indiscreet { + cmd.Println(hexPrivKey) + return nil + } + if err = printDiscreetly(ctx, cmd.ErrOrStderr(), "**Important** Do not share this private key.", hexPrivKey); err != nil { + return fmt.Errorf("failed to print private key: %w", err) + } + cmd.Println("Export private key successfully") return nil } diff --git a/client/keys/export_test.go b/client/keys/export_test.go index 96d1048e90b5..81036feafeae 100644 --- a/client/keys/export_test.go +++ b/client/keys/export_test.go @@ -21,12 +21,13 @@ import ( func Test_runExportCmd(t *testing.T) { cdc := moduletestutil.MakeTestEncodingConfig().Codec testCases := []struct { - name string - keyringBackend string - extraArgs []string - userInput string - mustFail bool - expectedOutput string + name string + keyringBackend string + extraArgs []string + userInput string + mustFail bool + expectedOutput string + expectedOutputContain string // only valid when expectedOutput is empty }{ { name: "--unsafe only must fail", @@ -49,9 +50,17 @@ func Test_runExportCmd(t *testing.T) { expectedOutput: "", }, { - name: "--unsafe --unarmored-hex succeed", + name: "--unsafe --unarmored-hex success", + keyringBackend: keyring.BackendTest, + extraArgs: []string{"--unsafe", "--unarmored-hex"}, + userInput: "y\n", + mustFail: false, + expectedOutputContain: "2485e33678db4175dc0ecef2d6e1fc493d4a0d7f7ce83324b6ed70afe77f3485\n", + }, + { + name: "--unsafe --unarmored-hex --indiscreet success", keyringBackend: keyring.BackendTest, - extraArgs: []string{"--unsafe", "--unarmored-hex"}, + extraArgs: []string{"--unsafe", "--unarmored-hex", "--indiscreet"}, userInput: "y\n", mustFail: false, expectedOutput: "2485e33678db4175dc0ecef2d6e1fc493d4a0d7f7ce83324b6ed70afe77f3485\n", @@ -59,7 +68,7 @@ func Test_runExportCmd(t *testing.T) { { name: "file keyring backend properly read password and user confirmation", keyringBackend: keyring.BackendFile, - extraArgs: []string{"--unsafe", "--unarmored-hex"}, + extraArgs: []string{"--unsafe", "--unarmored-hex", "--indiscreet"}, // first 2 pass for creating the key, then unsafe export confirmation, then unlock keyring pass userInput: "12345678\n12345678\ny\n12345678\n", mustFail: false, @@ -106,7 +115,11 @@ func Test_runExportCmd(t *testing.T) { require.Error(t, err) } else { require.NoError(t, err) - require.Equal(t, tc.expectedOutput, mockOut.String()) + if tc.expectedOutput != "" { + require.Equal(t, tc.expectedOutput, mockOut.String()) + } else if tc.expectedOutputContain != "" { + require.Contains(t, mockOut.String(), tc.expectedOutputContain) + } } }) } diff --git a/client/keys/mnemonic.go b/client/keys/mnemonic.go index ea7f9638d9be..50d0b74c09c2 100644 --- a/client/keys/mnemonic.go +++ b/client/keys/mnemonic.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/go-bip39" "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/input" ) @@ -64,12 +65,16 @@ func MnemonicKeyCommand() *cobra.Command { if err != nil { return err } - + indiscreet, _ := cmd.Flags().GetBool(flagIndiscreet) + if !indiscreet { + return printDiscreetly(client.GetClientContextFromCmd(cmd), cmd.ErrOrStderr(), "**Important** write this mnemonic phrase in a safe place. Do not share it to anyone.", mnemonic) + } cmd.Println(mnemonic) return nil }, } cmd.Flags().Bool(flagUserEntropy, false, "Prompt the user to supply their own entropy, instead of relying on the system") + cmd.Flags().Bool(flagIndiscreet, false, "Print mnemonic directly on current terminal") return cmd } diff --git a/client/keys/mnemonic_test.go b/client/keys/mnemonic_test.go index c986e6230b5d..3aa2d34669b2 100644 --- a/client/keys/mnemonic_test.go +++ b/client/keys/mnemonic_test.go @@ -21,7 +21,7 @@ func Test_RunMnemonicCmdUser(t *testing.T) { cmd := MnemonicKeyCommand() _ = testutil.ApplyMockIODiscardOutErr(cmd) - cmd.SetArgs([]string{fmt.Sprintf("--%s=1", flagUserEntropy)}) + cmd.SetArgs([]string{fmt.Sprintf("--%s", flagUserEntropy), fmt.Sprintf("--%s", flagIndiscreet)}) err := cmd.Execute() require.Error(t, err) require.Equal(t, "EOF", err.Error()) @@ -35,11 +35,14 @@ func Test_RunMnemonicCmdUser(t *testing.T) { "256-bits is 43 characters in Base-64, and 100 in Base-6. You entered 3, and probably want more", err.Error()) + mockIn, mockOut := testutil.ApplyMockIO(cmd) // Now provide "good" entropy :) fakeEntropy := strings.Repeat(":)", 40) + "\ny\n" // entropy + accept count mockIn.Reset(fakeEntropy) require.NoError(t, cmd.Execute()) + require.Equal(t, "volcano hungry midnight divorce post ship bicycle fitness hospital critic protect ring trim alien there safe fine subway style impulse identify right improve print\n", mockOut.String()) + mockIn = testutil.ApplyMockIODiscardOutErr(cmd) // Now provide "good" entropy but no answer fakeEntropy = strings.Repeat(":)", 40) + "\n" // entropy + accept count mockIn.Reset(fakeEntropy) @@ -50,3 +53,29 @@ func Test_RunMnemonicCmdUser(t *testing.T) { mockIn.Reset(fakeEntropy) require.NoError(t, cmd.Execute()) } + +func Test_RunMnemonicCmdUserDiscreetly(t *testing.T) { + cmd := MnemonicKeyCommand() + _ = testutil.ApplyMockIODiscardOutErr(cmd) + + cmd.SetArgs([]string{fmt.Sprintf("--%s", flagUserEntropy)}) + err := cmd.Execute() + require.Error(t, err) + require.Equal(t, "EOF", err.Error()) + + // Try again + mockIn := testutil.ApplyMockIODiscardOutErr(cmd) + mockIn.Reset("Hi!\n") + err = cmd.Execute() + require.Error(t, err) + require.Equal(t, + "256-bits is 43 characters in Base-64, and 100 in Base-6. You entered 3, and probably want more", + err.Error()) + + mockIn, mockOut := testutil.ApplyMockIO(cmd) + // Now provide "good" entropy :) + fakeEntropy := strings.Repeat(":)", 40) + "\ny\n" // entropy + accept count + mockIn.Reset(fakeEntropy) + require.NoError(t, cmd.Execute()) + require.Contains(t, mockOut.String(), "volcano hungry midnight divorce post ship bicycle fitness hospital critic protect ring trim alien there safe fine subway style impulse identify right improve print") +} diff --git a/client/keys/utils.go b/client/keys/utils.go index e01ef345d8dc..295af8750382 100644 --- a/client/keys/utils.go +++ b/client/keys/utils.go @@ -5,6 +5,7 @@ import ( "fmt" "io" + "github.com/muesli/termenv" "sigs.k8s.io/yaml" "github.com/cosmos/cosmos-sdk/client" @@ -71,3 +72,17 @@ func printTextRecords(w io.Writer, kos []KeyOutput) error { return nil } + +// printDiscreetly Print a secret string to an alternate screen, so the string isn't printed to the terminal. +func printDiscreetly(clientCtx client.Context, w io.Writer, promptMsg, secretMsg string) error { + output := termenv.NewOutput(w) + output.AltScreen() + defer output.ExitAltScreen() + if _, err := fmt.Fprintf(output, "%s\n\n%s\n\nPress 'Enter' key to continue.", promptMsg, secretMsg); err != nil { + return err + } + if _, err := fmt.Scanln(); err != nil { + return err + } + return nil +} diff --git a/client/tx/tx.go b/client/tx/tx.go index cae7cb9bf35f..f3363ad48972 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -246,7 +246,7 @@ func checkMultipleSigners(tx authsigning.Tx) error { // Sign signs a given tx with a named key. The bytes signed over are canconical. // The resulting signature will be added to the transaction builder overwriting the previous // ones if overwrite=true (otherwise, the signature will be appended). -// Signing a transaction with mutltiple signers in the DIRECT mode is not supprted and will +// Signing a transaction with mutltiple signers in the DIRECT mode is not supported and will // return an error. // An error is returned upon failure. func Sign(ctx context.Context, txf Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error { diff --git a/client/v2/README.md b/client/v2/README.md index 96c5359ff62a..5830667f644b 100644 --- a/client/v2/README.md +++ b/client/v2/README.md @@ -37,7 +37,7 @@ It is possible to customize the generation of transactions and queries by defini Here are the steps to use AutoCLI: 1. Ensure your app's modules implements the `appmodule.AppModule` interface. -2. (optional) Configure how behave `autocli` command generation, by implementing the `func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions` method on the module. +2. (optional) Configure how to behave as `autocli` command generation, by implementing the `func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions` method on the module. 3. Use the `autocli.AppOptions` struct to specify the modules you defined. If you are using `depinject` / app v2, it can automatically create an instance of `autocli.AppOptions` based on your app's configuration. 4. Use the `EnhanceRootCommand()` method provided by `autocli` to add the CLI commands for the specified modules to your root command. @@ -211,7 +211,7 @@ https://github.com/cosmos/cosmos-sdk/blob/main/client/grpc/cmtservice/autocli.go ## Summary -`autocli` let you generate CLI to your Cosmos SDK-based applications without any cobra boilerplate. It allows you to easily generate CLI commands and flags from your protobuf messages, and provides many options for customising the behavior of your CLI application. +`autocli` lets you generate CLI to your Cosmos SDK-based applications without any cobra boilerplate. It allows you to easily generate CLI commands and flags from your protobuf messages, and provides many options for customising the behavior of your CLI application. To further enhance your CLI experience with Cosmos SDK-based blockchains, you can use `hubl`. `hubl` is a tool that allows you to query any Cosmos SDK-based blockchain using the new AutoCLI feature of the Cosmos SDK. With `hubl`, you can easily configure a new chain and query modules with just a few simple commands. diff --git a/client/v2/go.mod b/client/v2/go.mod index 61d22fda7108..096b3d278dbc 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -33,7 +33,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -116,7 +118,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -142,15 +144,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect diff --git a/client/v2/go.sum b/client/v2/go.sum index aea59e70ec9d..97a980f989c5 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -639,8 +641,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -801,6 +803,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/codec/codec.go b/codec/codec.go index 6256f78a80a7..d26f91b35623 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -10,7 +10,7 @@ import ( type ( // Codec defines a functionality for serializing other objects. - // Users can defin a custom Protobuf-based serialization. + // Users can define a custom Protobuf-based serialization. // Note, Amino can still be used without any dependency on Protobuf. // SDK provides to Codec implementations: // diff --git a/codec/unknownproto/unknown_fields.go b/codec/unknownproto/unknown_fields.go index 9dda4e629b4b..5fa80001c0fe 100644 --- a/codec/unknownproto/unknown_fields.go +++ b/codec/unknownproto/unknown_fields.go @@ -44,12 +44,7 @@ func RejectUnknownFields(bz []byte, msg proto.Message, allowUnknownNonCriticals return hasUnknownNonCriticals, nil } - desc, ok := msg.(descriptorIface) - if !ok { - return hasUnknownNonCriticals, fmt.Errorf("%T does not have a Descriptor() method", msg) - } - - fieldDescProtoFromTagNum, _, err := getDescriptorInfo(desc, msg) + fieldDescProtoFromTagNum, _, err := getDescriptorInfo(msg) if err != nil { return hasUnknownNonCriticals, err } @@ -345,7 +340,11 @@ func unnestDesc(mdescs []*descriptorpb.DescriptorProto, indices []int) *descript // Invoking descriptorpb.ForMessage(proto.Message.(Descriptor).Descriptor()) is incredibly slow // for every single message, thus the need for a hand-rolled custom version that's performant and cacheable. -func extractFileDescMessageDesc(desc descriptorIface) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto, error) { +func extractFileDescMessageDesc(msg proto.Message) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto, error) { + desc, ok := msg.(descriptorIface) + if !ok { + return nil, nil, fmt.Errorf("%T does not have a Descriptor() method", msg) + } gzippedPb, indices := desc.Descriptor() protoFileToDescMu.RLock() @@ -391,7 +390,8 @@ var ( ) // getDescriptorInfo retrieves the mapping of field numbers to their respective field descriptors. -func getDescriptorInfo(desc descriptorIface, msg proto.Message) (map[int32]*descriptorpb.FieldDescriptorProto, *descriptorpb.DescriptorProto, error) { +func getDescriptorInfo(msg proto.Message) (map[int32]*descriptorpb.FieldDescriptorProto, *descriptorpb.DescriptorProto, error) { + // we immediately check if the desc is present in the desc key := reflect.ValueOf(msg).Type() descprotoCacheMu.RLock() @@ -403,7 +403,7 @@ func getDescriptorInfo(desc descriptorIface, msg proto.Message) (map[int32]*desc } // Now compute and cache the index. - _, md, err := extractFileDescMessageDesc(desc) + _, md, err := extractFileDescMessageDesc(msg) if err != nil { return nil, nil, err } diff --git a/collections/README.md b/collections/README.md index 2e1e691d6d11..751778af128b 100644 --- a/collections/README.md +++ b/collections/README.md @@ -604,7 +604,7 @@ we specified in the range. Then we use again th `Values` method of the `Iterator` to collect all the results. -`collections.Range` also offers a `Prefix` API which is not appliable to all keys types, +`collections.Range` also offers a `Prefix` API which is not applicable to all keys types, for example uint64 cannot be prefix because it is of constant size, but a `string` key can be prefixed. @@ -796,7 +796,7 @@ in `Pair` keys iterations. ``` As we can see here we're passing the type parameters of the `collections.Pair` because golang type inference -with respect to generics is not as permissive as other languages, so we need to explitly say what are the types of the pair key. +with respect to generics is not as permissive as other languages, so we need to explicitly say what are the types of the pair key. #### GetAllAddressesBalancesBetween diff --git a/collections/colltest/codec.go b/collections/colltest/codec.go index 58eb6f4ce446..54249ebf11a3 100644 --- a/collections/colltest/codec.go +++ b/collections/colltest/codec.go @@ -124,7 +124,7 @@ func (m mockValueCodec[T]) Decode(b []byte) (t T, err error) { typ, exists := m.seenTypes[wrappedValue.TypeName] if !exists { - return t, fmt.Errorf("uknown type %s, you're dealing with interfaces... in order to make the interface types known for the MockValueCodec, you need to first encode them", wrappedValue.TypeName) + return t, fmt.Errorf("unknown type %s, you're dealing with interfaces... in order to make the interface types known for the MockValueCodec, you need to first encode them", wrappedValue.TypeName) } newT := reflect.New(typ).Interface() diff --git a/contrib/images/simd-dlv/README.md b/contrib/images/simd-dlv/README.md index dcca3cde5c8b..d8955049976e 100644 --- a/contrib/images/simd-dlv/README.md +++ b/contrib/images/simd-dlv/README.md @@ -6,7 +6,7 @@ Cosmos-SDK provides you with a local network to bootstrap a chain in your machine, but how does one debug a node or module? -If we start a single node, we won't be able to debug transactions as the machine will be in bootstrapping phase trying to find peers to connect too, thats why we need to start a local network. +If we start a single node, we won't be able to debug transactions as the machine will be in bootstrapping phase trying to find peers to connect too, that's why we need to start a local network. But the current `localnet-start` does not provide us with debugging tools so that's why there is a different image for debugging a local network, that is to avoid any issues in the future were debugging won't be needed. diff --git a/crypto/hd/algo.go b/crypto/hd/algo.go index 58a5d4534240..d34bc6882390 100644 --- a/crypto/hd/algo.go +++ b/crypto/hd/algo.go @@ -2,6 +2,7 @@ package hd import ( "github.com/cosmos/go-bip39" + "gitlab.com/yawning/secp256k1-voi/secec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/crypto/types" @@ -65,6 +66,11 @@ func (s secp256k1Algo) Generate() GenerateFn { bzArr := make([]byte, secp256k1.PrivKeySize) copy(bzArr, bz) - return &secp256k1.PrivKey{Key: bzArr} + privKeyObj, err := secec.NewPrivateKey(bz) + if err != nil { + panic(err) + } + + return &secp256k1.PrivKey{Key: privKeyObj.Bytes()} } } diff --git a/crypto/hd/hdpath.go b/crypto/hd/hdpath.go index 7873ea0a2c0b..4c0529e8324e 100644 --- a/crypto/hd/hdpath.go +++ b/crypto/hd/hdpath.go @@ -262,7 +262,7 @@ func uint32ToBytes(i uint32) []byte { return b[:] } -// i64 returns the two halfs of the SHA512 HMAC of key and data. +// i64 returns the two halves of the SHA512 HMAC of key and data. func i64(key, data []byte) (il, ir [32]byte) { mac := hmac.New(sha512.New, key) // sha512 does not err diff --git a/crypto/keyring/keyring_test.go b/crypto/keyring/keyring_test.go index b6827618bc4b..b739b33b7bbe 100644 --- a/crypto/keyring/keyring_test.go +++ b/crypto/keyring/keyring_test.go @@ -1972,14 +1972,14 @@ func TestRenameKey(t *testing.T) { }, }, { - name: "cant rename a key that doesnt exist", + name: "can't rename a key that doesnt exist", run: func(kr Keyring) { err := kr.Rename("bogus", "bogus2") require.Error(t, err) }, }, { - name: "cant rename a key to an already existing key name", + name: "can't rename a key to an already existing key name", run: func(kr Keyring) { key1, key2 := "existingKey", "existingKey2" // create 2 keys newKeyRecord(t, kr, key1) @@ -1990,7 +1990,7 @@ func TestRenameKey(t *testing.T) { }, }, { - name: "cant rename key to itself", + name: "can't rename key to itself", run: func(kr Keyring) { keyName := "keyName" newKeyRecord(t, kr, keyName) diff --git a/crypto/keys/secp256k1/bench_test.go b/crypto/keys/secp256k1/bench_test.go index a9f694de7552..4f39d1763ac6 100644 --- a/crypto/keys/secp256k1/bench_test.go +++ b/crypto/keys/secp256k1/bench_test.go @@ -11,7 +11,7 @@ import ( func BenchmarkKeyGeneration(b *testing.B) { b.ReportAllocs() benchmarkKeygenWrapper := func(reader io.Reader) types.PrivKey { - priv := genPrivKey(reader) + priv := genPrivKey() return &PrivKey{Key: priv} } benchmarking.BenchmarkKeyGeneration(b, benchmarkKeygenWrapper) diff --git a/crypto/keys/secp256k1/internal/secp256k1/scalar_mult_cgo.go b/crypto/keys/secp256k1/internal/secp256k1/scalar_mult_cgo.go index 33566723c1a5..27c309ab08ec 100644 --- a/crypto/keys/secp256k1/internal/secp256k1/scalar_mult_cgo.go +++ b/crypto/keys/secp256k1/internal/secp256k1/scalar_mult_cgo.go @@ -8,11 +8,6 @@ // nolint // this nolint lets us use this file in its original and unmodified form. package secp256k1 -import ( - "math/big" - "unsafe" -) - /* #include "libsecp256k1/include/secp256k1.h" @@ -22,6 +17,11 @@ extern int secp256k1_ext_scalar_mul(const secp256k1_context* ctx, const unsigned */ import "C" +import ( + "math/big" + "unsafe" +) + func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, scalar []byte) (*big.Int, *big.Int) { // Ensure scalar is exactly 32 bytes. We pad always, even if // scalar is 32 bytes long, to avoid a timing side channel. diff --git a/crypto/keys/secp256k1/internal/secp256k1/secp256_test.go b/crypto/keys/secp256k1/internal/secp256k1/secp256_test.go index 04011643bea0..f899993ce45e 100644 --- a/crypto/keys/secp256k1/internal/secp256k1/secp256_test.go +++ b/crypto/keys/secp256k1/internal/secp256k1/secp256_test.go @@ -24,6 +24,7 @@ func generateKeyPair() (pubkey, privkey []byte) { if err != nil { panic(err) } + pubkey = elliptic.Marshal(S256(), key.X, key.Y) //nolint:staticcheck // crypto will be refactored soon. privkey = make([]byte, 32) blob := key.D.Bytes() diff --git a/crypto/keys/secp256k1/secp256k1.go b/crypto/keys/secp256k1/secp256k1.go index 2055a560e8ab..b995eb633492 100644 --- a/crypto/keys/secp256k1/secp256k1.go +++ b/crypto/keys/secp256k1/secp256k1.go @@ -10,6 +10,7 @@ import ( "github.com/cometbft/cometbft/crypto" secp256k1dcrd "github.com/decred/dcrd/dcrec/secp256k1/v4" + "gitlab.com/yawning/secp256k1-voi/secec" "golang.org/x/crypto/ripemd160" //nolint: staticcheck // keep around for backwards compatibility errorsmod "cosmossdk.io/errors" @@ -39,10 +40,12 @@ func (privKey *PrivKey) Bytes() []byte { // PubKey performs the point-scalar multiplication from the privKey on the // generator point to get the pubkey. func (privKey *PrivKey) PubKey() cryptotypes.PubKey { - pubkeyObject := secp256k1dcrd.PrivKeyFromBytes(privKey.Key).PubKey() + privateKeyObject, err := secec.NewPrivateKey(privKey.Key) + if err != nil { + panic(err) + } - pk := pubkeyObject.SerializeCompressed() - return &PubKey{Key: pk} + return &PubKey{Key: privateKeyObject.PublicKey().CompressedBytes()} } // Equals - you probably don't need to use this. @@ -85,11 +88,21 @@ func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { // GenPrivKey generates a new ECDSA private key on curve secp256k1 private key. // It uses OS randomness to generate the private key. func GenPrivKey() *PrivKey { - return &PrivKey{Key: genPrivKey(crypto.CReader())} + return &PrivKey{Key: genPrivKey()} +} + +// genPrivKey generates a new secp256k1 private key. +func genPrivKey() []byte { + privateKeyObject, err := secec.GenerateKey() + if err != nil { + panic(err) + } + + return privateKeyObject.Bytes() } -// genPrivKey generates a new secp256k1 private key using the provided reader. -func genPrivKey(rand io.Reader) []byte { +// genPrivKeyLegacy generates a new secp256k1 private key using the provided reader. +func genPrivKeyLegacy(rand io.Reader) []byte { var privKeyBytes [PrivKeySize]byte d := new(big.Int) for { diff --git a/crypto/keys/secp256k1/secp256k1_cgo_test.go b/crypto/keys/secp256k1/secp256k1_cgo_test.go index 2023175e8689..92579a3edf44 100644 --- a/crypto/keys/secp256k1/secp256k1_cgo_test.go +++ b/crypto/keys/secp256k1/secp256k1_cgo_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/magiconair/properties/assert" - "github.com/stretchr/testify/require" ) diff --git a/crypto/keys/secp256k1/secp256k1_internal_test.go b/crypto/keys/secp256k1/secp256k1_internal_test.go index 539420d00ee7..08afa6014e4b 100644 --- a/crypto/keys/secp256k1/secp256k1_internal_test.go +++ b/crypto/keys/secp256k1/secp256k1_internal_test.go @@ -31,11 +31,11 @@ func Test_genPrivKey(t *testing.T) { t.Run(tt.name, func(t *testing.T) { if tt.shouldPanic { require.Panics(t, func() { - genPrivKey(bytes.NewReader(tt.notSoRand)) + genPrivKeyLegacy(bytes.NewReader(tt.notSoRand)) }) return } - got := genPrivKey(bytes.NewReader(tt.notSoRand)) + got := genPrivKeyLegacy(bytes.NewReader(tt.notSoRand)) fe := new(big.Int).SetBytes(got) require.True(t, fe.Cmp(secp.S256().N) < 0) require.True(t, fe.Sign() > 0) diff --git a/crypto/keys/secp256k1/secp256k1_nocgo_test.go b/crypto/keys/secp256k1/secp256k1_nocgo_test.go index ffea5d82d788..04327fac626d 100644 --- a/crypto/keys/secp256k1/secp256k1_nocgo_test.go +++ b/crypto/keys/secp256k1/secp256k1_nocgo_test.go @@ -6,7 +6,7 @@ package secp256k1 import ( "testing" - secp256k1 "github.com/decred/dcrd/dcrec/secp256k1/v4" + secp256k1_dcrd "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/stretchr/testify/require" ) @@ -19,9 +19,9 @@ func TestSignatureVerificationAndRejectUpperS(t *testing.T) { priv := GenPrivKey() sigStr, err := priv.Sign(msg) require.NoError(t, err) - var r secp256k1.ModNScalar + var r secp256k1_dcrd.ModNScalar r.SetByteSlice(sigStr[:32]) - var s secp256k1.ModNScalar + var s secp256k1_dcrd.ModNScalar s.SetByteSlice(sigStr[32:64]) require.False(t, s.IsOverHalfOrder()) @@ -29,8 +29,8 @@ func TestSignatureVerificationAndRejectUpperS(t *testing.T) { require.True(t, pub.VerifySignature(msg, sigStr)) // malleate: - var S256 secp256k1.ModNScalar - S256.SetByteSlice(secp256k1.S256().N.Bytes()) + var S256 secp256k1_dcrd.ModNScalar + S256.SetByteSlice(secp256k1_dcrd.S256().N.Bytes()) s.Negate().Add(&S256) require.True(t, s.IsOverHalfOrder()) @@ -46,3 +46,20 @@ func TestSignatureVerificationAndRejectUpperS(t *testing.T) { ) } } + +func TestConstantTimePubKeyGeneration(t *testing.T) { + for i := 0; i < 500; i++ { + pk := GenPrivKey().PubKey() + require.NotNil(t, pk) + } +} + +// Legacy generation code +func TestNonConstantTimePubKeyGeneration(t *testing.T) { + for i := 0; i < 500; i++ { + privKey := GenPrivKey() + nonConstantTimePk := secp256k1_dcrd.PrivKeyFromBytes(privKey.Key).PubKey().SerializeCompressed() // Legacy functionality from pubkey + pk := &PubKey{Key: nonConstantTimePk} + require.NotNil(t, pk) + } +} diff --git a/crypto/keys/secp256k1/secp256k1_test.go b/crypto/keys/secp256k1/secp256k1_test.go index 299bbfcefcaf..5fabc6188ca0 100644 --- a/crypto/keys/secp256k1/secp256k1_test.go +++ b/crypto/keys/secp256k1/secp256k1_test.go @@ -450,3 +450,14 @@ func TestMarshalAmino_BackwardsCompatibility(t *testing.T) { }) } } + +func TestLegacyKeyGenerationAgainstConstantTime(t *testing.T) { + privKey := secp256k1.GenPrivKey() + + pubKey := privKey.PubKey() + + nonConstantTimePk := secp.PrivKeyFromBytes(privKey.Key).PubKey().SerializeCompressed() // Legacy functionality from pubkey + legacyPubKey := &secp256k1.PubKey{Key: nonConstantTimePk} + + require.Equal(t, legacyPubKey, pubKey) +} diff --git a/crypto/ledger/ledger_secp256k1.go b/crypto/ledger/ledger_secp256k1.go index dde6acd005d2..174fbfb091c0 100644 --- a/crypto/ledger/ledger_secp256k1.go +++ b/crypto/ledger/ledger_secp256k1.go @@ -8,6 +8,7 @@ import ( secp "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa" + "gitlab.com/yawning/secp256k1-voi/secec" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -320,13 +321,13 @@ func getPubKeyUnsafe(device SECP256K1, path hd.BIP44Params) (types.PubKey, error } // re-serialize in the 33-byte compressed format - cmp, err := secp.ParsePubKey(publicKey) + cmp, err := secec.NewPublicKey(publicKey) if err != nil { return nil, fmt.Errorf("error parsing public key: %w", err) } compressedPublicKey := make([]byte, secp256k1.PubKeySize) - copy(compressedPublicKey, cmp.SerializeCompressed()) + copy(compressedPublicKey, cmp.CompressedBytes()) return options.createPubkey(compressedPublicKey), nil } @@ -344,13 +345,13 @@ func getPubKeyAddrSafe(device SECP256K1, path hd.BIP44Params, hrp string) (types } // re-serialize in the 33-byte compressed format - cmp, err := secp.ParsePubKey(publicKey) + cmp, err := secec.NewPublicKey(publicKey) if err != nil { return nil, "", fmt.Errorf("error parsing public key: %w", err) } compressedPublicKey := make([]byte, secp256k1.PubKeySize) - copy(compressedPublicKey, cmp.SerializeCompressed()) + copy(compressedPublicKey, cmp.CompressedBytes()) return options.createPubkey(compressedPublicKey), addr, nil } diff --git a/docs/architecture/PROCESS.md b/docs/architecture/PROCESS.md index ff8314731682..5129c88dbe6e 100644 --- a/docs/architecture/PROCESS.md +++ b/docs/architecture/PROCESS.md @@ -8,7 +8,7 @@ ## What is an ADR? -An ADR is a document to document an implementation and design that may or may not have been discussed in an RFC. While an RFC is meant to replace synchoronus communication in a distributed environment, an ADR is meant to document an already made decision. An ADR wont come with much of a communication overhead because the discussion was recorded in an RFC or a synchronous discussion. If the consensus came from a synchoronus discussion then a short excerpt should be added to the ADR to explain the goals. +An ADR is a document to document an implementation and design that may or may not have been discussed in an RFC. While an RFC is meant to replace synchoronus communication in a distributed environment, an ADR is meant to document an already made decision. An ADR won't come with much of a communication overhead because the discussion was recorded in an RFC or a synchronous discussion. If the consensus came from a synchoronus discussion then a short excerpt should be added to the ADR to explain the goals. ## ADR life cycle diff --git a/docs/architecture/README.md b/docs/architecture/README.md index ae22cc160418..6ff313fb0be2 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -60,6 +60,7 @@ When writing ADRs, follow the same best practices for writing RFCs. When writing * [ADR 058: Auto-Generated CLI](./adr-058-auto-generated-cli.md) * [ADR 060: ABCI 1.0 (Phase I)](adr-060-abci-1.0.md) * [ADR 061: Liquid Staking](./adr-061-liquid-staking.md) +* [ADR 070: Un-Ordered Transaction Inclusion](./adr-070-unordered-account.md) ### Proposed diff --git a/docs/architecture/adr-007-specialization-groups.md b/docs/architecture/adr-007-specialization-groups.md index bafcc697bf2c..dd5617a49d09 100644 --- a/docs/architecture/adr-007-specialization-groups.md +++ b/docs/architecture/adr-007-specialization-groups.md @@ -10,7 +10,7 @@ This idea was first conceived of in order to fulfill the use case of the creation of a decentralized Computer Emergency Response Team (dCERT), whose members would be elected by a governing community and would fulfill the role of coordinating the community under emergency situations. This thinking -can be further abstracted into the conception of "blockchain specialization +can be further abstracted into the concept of "blockchain specialization groups". The creation of these groups are the beginning of specialization capabilities @@ -44,7 +44,7 @@ A specialization group can be broadly broken down into the following functions * Individual compensation for all constituents of a group from the greater community -Membership admittance to a specialization group could take place over a wide +Membership admission to a specialization group could take place over a wide variety of mechanisms. The most obvious example is through a general vote among the entire community, however in certain systems a community may want to allow the members already in a specialization group to internally elect new members, diff --git a/docs/architecture/adr-014-proportional-slashing.md b/docs/architecture/adr-014-proportional-slashing.md index 63cd04dee307..976136a9f59f 100644 --- a/docs/architecture/adr-014-proportional-slashing.md +++ b/docs/architecture/adr-014-proportional-slashing.md @@ -49,7 +49,7 @@ Griefing, the act of intentionally getting oneself slashed in order to make anot ### Implementation -In the slashing module, we will add two queues that will track all of the recent slash events. For double sign faults, we will define "recent slashes" as ones that have occurred within the last `unbonding period`. For liveness faults, we will define "recent slashes" as ones that have occurred withing the last `jail period`. +In the slashing module, we will add two queues that will track all of the recent slash events. For double sign faults, we will define "recent slashes" as ones that have occurred within the last `unbonding period`. For liveness faults, we will define "recent slashes" as ones that have occurred within the last `jail period`. ```go type SlashEvent struct { diff --git a/docs/architecture/adr-018-extendable-voting-period.md b/docs/architecture/adr-018-extendable-voting-period.md index 5e8f058d12fa..bf7733908cf0 100644 --- a/docs/architecture/adr-018-extendable-voting-period.md +++ b/docs/architecture/adr-018-extendable-voting-period.md @@ -27,7 +27,7 @@ There is a new `Msg` type called `MsgExtendVotingPeriod`, which can be sent by a So for example, if the `MaxVotingPeriodExtension` is set to 100 Days, then anyone with 1% of voting power can extend the voting power by 1 day. If 33% of voting power has sent the message, the voting period will be extended by 33 days. Thus, if absolutely everyone chooses to extend the voting period, the absolute maximum voting period will be `MinVotingPeriod + MaxVotingPeriodExtension`. -This system acts as a sort of distributed coordination, where individual stakers choosing to extend or not, allows the system the guage the conentiousness/complexity of the proposal. It is extremely unlikely that many stakers will choose to extend at the exact same time, it allows stakers to view how long others have already extended thus far, to decide whether or not to extend further. +This system acts as a sort of distributed coordination, where individual stakers choosing to extend or not, allows the system the gauge the conentiousness/complexity of the proposal. It is extremely unlikely that many stakers will choose to extend at the exact same time, it allows stakers to view how long others have already extended thus far, to decide whether or not to extend further. ### Dealing with Unbonding/Redelegation diff --git a/docs/architecture/adr-021-protobuf-query-encoding.md b/docs/architecture/adr-021-protobuf-query-encoding.md index a90e807d50e9..a87c6c7ea998 100644 --- a/docs/architecture/adr-021-protobuf-query-encoding.md +++ b/docs/architecture/adr-021-protobuf-query-encoding.md @@ -176,7 +176,7 @@ service Query { } ``` -grpc-gateway will work direcly against the GRPC proxy described above which will +grpc-gateway will work directly against the GRPC proxy described above which will translate requests to ABCI queries under the hood. grpc-gateway can also generate Swagger definitions automatically. diff --git a/docs/architecture/adr-031-msg-service.md b/docs/architecture/adr-031-msg-service.md index 62106719c94a..9795e571dcac 100644 --- a/docs/architecture/adr-031-msg-service.md +++ b/docs/architecture/adr-031-msg-service.md @@ -40,7 +40,7 @@ in `x/gov`, `MsgSubmitProposal` returns the proposal ID as a big-endian `uint64 This isn’t really documented anywhere and clients would need to know the internals of the Cosmos SDK to parse that value and return it to users. -Also, there may be cases where we want to use these return values programatically. +Also, there may be cases where we want to use these return values programmatically. For instance, https://github.com/cosmos/cosmos-sdk/issues/7093 proposes a method for doing inter-module Ocaps using the `Msg` router. A well-defined return type would improve the developer UX for this approach. @@ -82,7 +82,7 @@ the intent of the [protobuf spec](https://developers.google.com/protocol-buffers With this approach, we would get an auto-generated `MsgServer` interface: In addition to clearly specifying return types, this has the benefit of generating client and server code. On the server -side, this is almost like an automatically generated keeper method and could maybe be used intead of keepers eventually +side, this is almost like an automatically generated keeper method and could maybe be used instead of keepers eventually (see [\#7093](https://github.com/cosmos/cosmos-sdk/issues/7093)): ```go @@ -118,7 +118,7 @@ We propose to add a `msg_service_router` in BaseApp. This router is a key/value When a transaction is processed by BaseApp (in CheckTx or in DeliverTx), its `TxBody.messages` are decoded as `Msg`s. Each `Msg`'s `type_url` is matched against an entry in the `msg_service_router`, and the respective `Msg` service method handler is called. -For backward compatibility, the old handlers are not removed yet. If BaseApp receives a legacy `Msg` with no correspoding entry in the `msg_service_router`, it will be routed via its legacy `Route()` method into the legacy handler. +For backward compatibility, the old handlers are not removed yet. If BaseApp receives a legacy `Msg` with no corresponding entry in the `msg_service_router`, it will be routed via its legacy `Route()` method into the legacy handler. ### Module Configuration diff --git a/docs/architecture/adr-032-typed-events.md b/docs/architecture/adr-032-typed-events.md index 76c651b7f5c0..037781917b3d 100644 --- a/docs/architecture/adr-032-typed-events.md +++ b/docs/architecture/adr-032-typed-events.md @@ -22,7 +22,7 @@ Currently in the Cosmos SDK, events are defined in the handlers for each message Currently in the Cosmos SDK, events are defined in the handlers for each message, meaning each module doesn't have a canonical set of types for each event. Above all else this makes these events difficult to consume as it requires a great deal of raw string matching and parsing. This proposal focuses on updating the events to use **typed events** defined in each module such that emitting and subscribing to events will be much easier. This workflow comes from the experience of the Akash Network team. -[Our platform](http://github.com/ovrclk/akash) requires a number of programatic on chain interactions both on the provider (datacenter - to bid on new orders and listen for leases created) and user (application developer - to send the app manifest to the provider) side. In addition the Akash team is now maintaining the IBC [`relayer`](https://github.com/ovrclk/relayer), another very event driven process. In working on these core pieces of infrastructure, and integrating lessons learned from Kubernetes development, our team has developed a standard method for defining and consuming typed events in Cosmos SDK modules. We have found that it is extremely useful in building this type of event driven application. +[Our platform](http://github.com/ovrclk/akash) requires a number of programmatic on chain interactions both on the provider (datacenter - to bid on new orders and listen for leases created) and user (application developer - to send the app manifest to the provider) side. In addition the Akash team is now maintaining the IBC [`relayer`](https://github.com/ovrclk/relayer), another very event driven process. In working on these core pieces of infrastructure, and integrating lessons learned from Kubernetes development, our team has developed a standard method for defining and consuming typed events in Cosmos SDK modules. We have found that it is extremely useful in building this type of event driven application. As the Cosmos SDK gets used more extensively for apps like `peggy`, other peg zones, IBC, DeFi, etc... there will be an exploding demand for event driven applications to support new features desired by users. We propose upstreaming our findings into the Cosmos SDK to enable all Cosmos SDK applications to quickly and easily build event driven apps to aid their core application. Wallets, exchanges, explorers, and defi protocols all stand to benefit from this work. @@ -308,7 +308,7 @@ func PublishChainTxEvents(ctx context.Context, client cmtclient.EventsClient, bu return err }) - // Exit on error or context cancelation + // Exit on error or context cancellation return g.Wait() } ``` diff --git a/docs/architecture/adr-034-account-rekeying.md b/docs/architecture/adr-034-account-rekeying.md index 6abe37e43e9a..83f839efa704 100644 --- a/docs/architecture/adr-034-account-rekeying.md +++ b/docs/architecture/adr-034-account-rekeying.md @@ -50,7 +50,7 @@ An account that has had its pubkey changed cannot be automatically pruned from s ctx.GasMeter().ConsumeGas(amount, "pubkey change fee") ``` -Everytime a key for an address is changed, we will store a log of this change in the state of the chain, thus creating a stack of all previous keys for an address and the time intervals for which they were active. This allows dapps and clients to easily query past keys for an account which may be useful for features such as verifying timestamped off-chain signed messages. +Every time a key for an address is changed, we will store a log of this change in the state of the chain, thus creating a stack of all previous keys for an address and the time intervals for which they were active. This allows dapps and clients to easily query past keys for an account which may be useful for features such as verifying timestamped off-chain signed messages. ## Consequences diff --git a/docs/architecture/adr-037-gov-split-vote.md b/docs/architecture/adr-037-gov-split-vote.md index 0a3b9bc43ddb..c369ad8b1cf1 100644 --- a/docs/architecture/adr-037-gov-split-vote.md +++ b/docs/architecture/adr-037-gov-split-vote.md @@ -2,7 +2,7 @@ ## Changelog -* 2020/10/28: Intial draft +* 2020/10/28: Initial draft ## Status diff --git a/docs/architecture/adr-038-state-listening.md b/docs/architecture/adr-038-state-listening.md index 319d872be36e..56541567e6fa 100644 --- a/docs/architecture/adr-038-state-listening.md +++ b/docs/architecture/adr-038-state-listening.md @@ -7,7 +7,7 @@ * 10/14/2022: * Add `ListenCommit`, flatten the state writes in a block to a single batch. * Remove listeners from cache stores, should only listen to `rootmulti.Store`. - * Remove `HaltAppOnDeliveryError()`, the errors are propagated by default, the implementations should return nil if don't want to propogate errors. + * Remove `HaltAppOnDeliveryError()`, the errors are propagated by default, the implementations should return nil if don't want to propagate errors. * 26/05/2023: Update with ABCI 2.0 ## Status @@ -354,7 +354,7 @@ var Handshake = plugin.HandshakeConfig{ MagicCookieValue: "ef78114d-7bdf-411c-868f-347c99a78345", } -// ListenerPlugin is the base struc for all kinds of go-plugin implementations +// ListenerPlugin is the base struct for all kinds of go-plugin implementations // It will be included in interfaces of different Plugins type ABCIListenerPlugin struct { // GRPCPlugin must still implement the Plugin interface diff --git a/docs/architecture/adr-039-epoched-staking.md b/docs/architecture/adr-039-epoched-staking.md index 23f25ea10a7c..c343ac514f5b 100644 --- a/docs/architecture/adr-039-epoched-staking.md +++ b/docs/architecture/adr-039-epoched-staking.md @@ -45,7 +45,7 @@ Applying it immediately can be viewed as offering greater consensus layer securi * For threshold based cryptography, this setting will have the threshold cryptography use the original epoch weights, while consensus has an update that lets it more rapidly benefit from additional security. If the threshold based cryptography blocks liveness of the chain, then we have effectively raised the liveness threshold of the remaining validators for the rest of the epoch. (Alternatively, jailed nodes could still contribute shares) This plan will fail in the extreme case that more than 1/3rd of the validators have been jailed within a single epoch. For such an extreme scenario, the chain already have its own custom incident response plan, and defining how to handle the threshold cryptography should be a part of that. * For light client efficiency, there can be a bit included in the header indicating an intra-epoch slash (ala https://github.com/tendermint/spec/issues/199). -* For fairness of deterministic leader election, applying a slash or jailing within an epoch would break the guarantee we were seeking to provide. This then re-introduces a new (but significantly simpler) problem for trying to provide fairness guarantees. Namely, that validators can adversarially elect to remove themself from the set of proposers. From a security perspective, this could potentially be handled by two different mechanisms (or prove to still be too difficult to achieve). One is making a security statement acknowledging the ability for an adversary to force an ahead-of-time fixed threshold of users to drop out of the proposer set within an epoch. The second method would be to parameterize such that the cost of a slash within the epoch far outweights benefits due to being a proposer. However, this latter criterion is quite dubious, since being a proposer can have many advantageous side-effects in chains with complex state machines. (Namely, DeFi games such as Fomo3D) +* For fairness of deterministic leader election, applying a slash or jailing within an epoch would break the guarantee we were seeking to provide. This then re-introduces a new (but significantly simpler) problem for trying to provide fairness guarantees. Namely, that validators can adversarially elect to remove themself from the set of proposers. From a security perspective, this could potentially be handled by two different mechanisms (or prove to still be too difficult to achieve). One is making a security statement acknowledging the ability for an adversary to force an ahead-of-time fixed threshold of users to drop out of the proposer set within an epoch. The second method would be to parameterize such that the cost of a slash within the epoch far outweighs benefits due to being a proposer. However, this latter criterion is quite dubious, since being a proposer can have many advantageous side-effects in chains with complex state machines. (Namely, DeFi games such as Fomo3D) * For staking derivative design, there is no issue introduced. This does not increase the state size of staking records, since whether a slash has occurred is fully queryable given the validator address. ### Token lockup diff --git a/docs/architecture/adr-041-in-place-store-migrations.md b/docs/architecture/adr-041-in-place-store-migrations.md index d2570d6409b9..e9fc374bcb90 100644 --- a/docs/architecture/adr-041-in-place-store-migrations.md +++ b/docs/architecture/adr-041-in-place-store-migrations.md @@ -134,7 +134,7 @@ app.UpgradeKeeper.SetUpgradeHandler("my-plan", func(ctx sdk.Context, plan upgrad Assuming a chain upgrades at block `n`, the procedure should run as follows: * the old binary will halt in `BeginBlock` when starting block `N`. In its store, the ConsensusVersions of the old binary's modules are stored. -* the new binary will start at block `N`. The UpgradeHandler is set in the new binary, so will run at `BeginBlock` of the new binary. Inside `x/upgrade`'s `ApplyUpgrade`, the `VersionMap` will be retrieved from the (old binary's) store, and passed into the `RunMigrations` functon, migrating all module stores in-place before the modules' own `BeginBlock`s. +* the new binary will start at block `N`. The UpgradeHandler is set in the new binary, so will run at `BeginBlock` of the new binary. Inside `x/upgrade`'s `ApplyUpgrade`, the `VersionMap` will be retrieved from the (old binary's) store, and passed into the `RunMigrations` function, migrating all module stores in-place before the modules' own `BeginBlock`s. ## Consequences diff --git a/docs/architecture/adr-042-group-module.md b/docs/architecture/adr-042-group-module.md index 52e94327df74..8fef619f7e04 100644 --- a/docs/architecture/adr-042-group-module.md +++ b/docs/architecture/adr-042-group-module.md @@ -22,7 +22,7 @@ The legacy amino multi-signature mechanism of the Cosmos SDK has certain limitat * It requires `legacy_amino` sign mode ([#8141](https://github.com/cosmos/cosmos-sdk/issues/8141)). While the group module is not meant to be a total replacement for the current multi-signature accounts, it provides a solution to the limitations described above, with a more flexible key management system where keys can be added, updated or removed, as well as configurable thresholds. -It's meant to be used with other access control modules such as [`x/feegrant`](./adr-029-fee-grant-module.md) ans [`x/authz`](adr-030-authz-module.md) to simplify key management for individuals and organizations. +It's meant to be used with other access control modules such as [`x/feegrant`](./adr-029-fee-grant-module.md) and [`x/authz`](adr-030-authz-module.md) to simplify key management for individuals and organizations. The proof of concept of the group module can be found in https://github.com/regen-network/regen-ledger/tree/master/proto/regen/group/v1alpha1 and https://github.com/regen-network/regen-ledger/tree/master/x/group. diff --git a/docs/architecture/adr-048-consensus-fees.md b/docs/architecture/adr-048-consensus-fees.md index f1c6065cdfd1..e59e899dfd87 100644 --- a/docs/architecture/adr-048-consensus-fees.md +++ b/docs/architecture/adr-048-consensus-fees.md @@ -72,7 +72,7 @@ This mechanism can be easily composed with prioritization mechanisms: * we can add extra tiers out of a user control: * Example 1: user can set tier 0, 10 or 20, but the protocol will create tiers 0, 1, 2 ... 29. For example IBC transactions will go to tier `user_tier + 5`: if user selected tier 1, then the transaction will go to tier 15. * Example 2: we can reserve tier 4, 5, ... only for special transaction types. For example, tier 5 is reserved for evidence tx. So if submits a bank.Send transaction and set tier 5, it will be delegated to tier 3 (the max tier level available for any transaction). - * Example 3: we can enforce that all transactions of a sepecific type will go to specific tier. For example, tier 100 will be reserved for evidence transactions and all evidence transactions will always go to that tier. + * Example 3: we can enforce that all transactions of a specific type will go to specific tier. For example, tier 100 will be reserved for evidence transactions and all evidence transactions will always go to that tier. ### `min-gas-prices` diff --git a/docs/architecture/adr-049-state-sync-hooks.md b/docs/architecture/adr-049-state-sync-hooks.md index b4ec457a483c..90341d543a2b 100644 --- a/docs/architecture/adr-049-state-sync-hooks.md +++ b/docs/architecture/adr-049-state-sync-hooks.md @@ -31,7 +31,7 @@ acting as a delimiter between extensions. As the chunk hashes should be able to a delimiter to mark the end of the snapshot stream. Besides, we provide `Snapshotter` and `ExtensionSnapshotter` interface for modules to implement snapshotters, which will handle both taking -snapshot and the restoration. Each module could have mutiple snapshotters, and for modules with additional state, they should +snapshot and the restoration. Each module could have multiple snapshotters, and for modules with additional state, they should implement `ExtensionSnapshotter` as extension snapshotters. When setting up the application, the snapshot `Manager` should call `RegisterExtensions([]ExtensionSnapshotter…)` to register all the extension snapshotters. diff --git a/docs/architecture/adr-050-sign-mode-textual-annex2.md b/docs/architecture/adr-050-sign-mode-textual-annex2.md index 9bd0f3f47430..e27981047415 100644 --- a/docs/architecture/adr-050-sign-mode-textual-annex2.md +++ b/docs/architecture/adr-050-sign-mode-textual-annex2.md @@ -25,7 +25,7 @@ Unicode text within the transaction. `SIGN_MODE_TEXTUAL` renders to an abstract representation, leaving it up to device-specific software how to present this representation given the -capabilities, limitations, and conventions of the deivce. +capabilities, limitations, and conventions of the device. We offer the following normative guidance: @@ -77,7 +77,7 @@ in many languages: * All other ASCII control characters, plus non-ASCII Unicode code points, are shown as either: - * `\u` followed by 4 uppercase hex chacters for code points + * `\u` followed by 4 uppercase hex characters for code points in the basic multilingual plane (BMP). * `\U` followed by 8 uppercase hex characters for other code points. @@ -116,7 +116,7 @@ Indent Text 0 ">tricky key4<: note the leading space in the presentation" 0 "introducing an aggregate" 1 "key5: false" -1 "key6: a very long line of text, please coöperate and break into multiple lines." +1 "key6: a very long line of text, please cooperate and break into multiple lines." 1 "Can we do further nesting?" 2 "You bet we can!" ``` diff --git a/docs/architecture/adr-050-sign-mode-textual.md b/docs/architecture/adr-050-sign-mode-textual.md index 2d2aaee365b6..6432489aa5d7 100644 --- a/docs/architecture/adr-050-sign-mode-textual.md +++ b/docs/architecture/adr-050-sign-mode-textual.md @@ -72,7 +72,7 @@ or needs to be present only for signature integrity (see below). We require that the rendering of the transaction be invertible: there must be a parsing function such that for every transaction, when rendered to the textual representation, -parsing that representation yeilds a proto message equivalent +parsing that representation yields a proto message equivalent to the original under proto equality. Note that this inverse function does not need to perform correct @@ -145,7 +145,7 @@ type SignDocTextual struct { ``` We do not plan to use protobuf serialization to form the sequence of bytes -that will be tranmitted and signed, in order to keep the decoder simple. +that will be transmitted and signed, in order to keep the decoder simple. We will use [CBOR](https://cbor.io) ([RFC 8949](https://www.rfc-editor.org/rfc/rfc8949.html)) instead. The encoding is defined by the following CDDL ([RFC 8610](https://www.rfc-editor.org/rfc/rfc8610)): @@ -310,7 +310,7 @@ The current specification is not set in stone, and future iterations are to be e 1. Updates that require changes of the hardware device embedded application. 2. Updates that only modify the envelope and the value renderers. -Updates in the 1st category include changes of the `Screen` struct or its corresponding CBOR encoding. This type of updates require a modification of the hardware signer application, to be able to decode and parse the new types. Backwards-compatibility must also be guaranteed, so that the new hardware application works with existing versions of the SDK. These updates require the coordination of multiple parties: SDK developers, hardware application developers (currently: Zondax), and client-side developers (e.g. CosmJS). Furthermore, a new submission of the hardware device application may be necessary, which, dependending on the vendor, can take some time. As such, we recommend to avoid this type of updates as much as possible. +Updates in the 1st category include changes of the `Screen` struct or its corresponding CBOR encoding. This type of updates require a modification of the hardware signer application, to be able to decode and parse the new types. Backwards-compatibility must also be guaranteed, so that the new hardware application works with existing versions of the SDK. These updates require the coordination of multiple parties: SDK developers, hardware application developers (currently: Zondax), and client-side developers (e.g. CosmJS). Furthermore, a new submission of the hardware device application may be necessary, which, depending on the vendor, can take some time. As such, we recommend to avoid this type of updates as much as possible. Updates in the 2nd category include changes to any of the value renderers or to the transaction envelope. For example, the ordering of fields in the envelope can be swapped, or the timestamp formatting can be modified. Since SIGN_MODE_TEXTUAL sends `Screen`s to the hardware device, this type of change do not need a hardware wallet application update. They are however state-machine-breaking, and must be documented as such. They require the coordination of SDK developers with client-side developers (e.g. CosmJS), so that the updates are released on both sides close to each other in time. diff --git a/docs/architecture/adr-061-liquid-staking.md b/docs/architecture/adr-061-liquid-staking.md index fcfeda0d3ed2..81ce2f48575d 100644 --- a/docs/architecture/adr-061-liquid-staking.md +++ b/docs/architecture/adr-061-liquid-staking.md @@ -20,7 +20,7 @@ As both Proof of Stake and blockchain use cases have matured, this design has ag The most important deficiency of the legacy staking design is that it composes poorly with on chain protocols for trading, lending, derivatives that are referred to collectively as DeFi. The legacy staking implementation starves these applications of liquidity by increasing the risk free rate adaptively. It basically makes DeFi and staking security somewhat incompatible. -The Osmosis team has adopted the idea of Superfluid and Interfluid staking where assets that are participating in DeFi appliactions can also be used in proof of stake. This requires tight integration with an enshrined set of DeFi applications and thus is unsuitable for the Cosmos SDK. +The Osmosis team has adopted the idea of Superfluid and Interfluid staking where assets that are participating in DeFi applications can also be used in proof of stake. This requires tight integration with an enshrined set of DeFi applications and thus is unsuitable for the Cosmos SDK. It's also important to note that Interchain Accounts are available in the default IBC implementation and can be used to [rehypothecate](https://www.investopedia.com/terms/h/hypothecation.asp#toc-what-is-rehypothecation) delegations. Thus liquid staking is already possible and these changes merely improve the UX of liquid staking. Centralized exchanges also rehypothecate staked assets, posing challenges for decentralization. This ADR takes the position that adoption of in-protocol liquid staking is the preferable outcome and provides new levers to incentivize decentralization of stake. diff --git a/docs/architecture/adr-063-core-module-api.md b/docs/architecture/adr-063-core-module-api.md index 743dd5fee539..0b9b7436acf9 100644 --- a/docs/architecture/adr-063-core-module-api.md +++ b/docs/architecture/adr-063-core-module-api.md @@ -282,7 +282,7 @@ type HasGenesis interface { #### Pre Blockers -Modules that have functionality that runs before BeginBlock and should implement the has `HasPreBlocker` interfaces: +Modules that have functionality that runs before BeginBlock and should implement the `HasPreBlocker` interfaces: ```go type HasPreBlocker interface { @@ -294,7 +294,7 @@ type HasPreBlocker interface { #### Begin and End Blockers Modules that have functionality that runs before transactions (begin blockers) or after transactions -(end blockers) should implement the has `HasBeginBlocker` and/or `HasEndBlocker` interfaces: +(end blockers) should implement the `HasBeginBlocker` and/or `HasEndBlocker` interfaces: ```go type HasBeginBlocker interface { @@ -452,7 +452,7 @@ func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.Mo The `core` module will define a static integer var, `cosmossdk.io/core.RuntimeCompatibilityVersion`, which is a minor version indicator of the core module that is accessible at runtime. Correct runtime module implementations should check this compatibility version and return an error if the current `RuntimeCompatibilityVersion` is higher -than the version of the core API that this runtime version can support. When new features are adding to the `core` +than the version of the core API that this runtime version can support. When new features are added to the `core` module API that runtime modules are required to support, this version should be incremented. ### Runtime Modules diff --git a/docs/architecture/adr-064-abci-2.0.md b/docs/architecture/adr-064-abci-2.0.md index c0dc7f746e81..80383f83d5d2 100644 --- a/docs/architecture/adr-064-abci-2.0.md +++ b/docs/architecture/adr-064-abci-2.0.md @@ -25,7 +25,7 @@ includes `ExtendVote`, `VerifyVoteExtension` and `FinalizeBlock`. ABCI 2.0 continues the promised updates from ABCI++, specifically three additional ABCI methods that the application can implement in order to gain further control, insight and customization of the consensus process, unlocking many novel use-cases -that previously not possible. We describe these three new methods below: +that were previously not possible. We describe these three new methods below: ### `ExtendVote` diff --git a/docs/architecture/adr-067-simulator-v2.md b/docs/architecture/adr-067-simulator-v2.md index 9398aaef601b..ae27f01e24bb 100644 --- a/docs/architecture/adr-067-simulator-v2.md +++ b/docs/architecture/adr-067-simulator-v2.md @@ -137,7 +137,7 @@ func (s *Simulator) SimulateBlock() { } ``` -Note, some application do not define or need their own app-side mempool, so we +Note, some applications do not define or need their own app-side mempool, so we propose that `SelectTxs` mimic CometBFT and just return FIFO-ordered transactions from an ad-hoc simulator mempool. In the case where an application does define its own mempool, it will simply ignore what is provided in `RequestPrepareProposal`. @@ -162,7 +162,7 @@ set of validity predicates, i.e. invariant checkers, that will be executed befor and after each block. This will allow for the application to assert that certain state invariants are held before and after each block. Note, as a consequence of this, we propose to remove the existing notion of invariants from module production -execution paths and deprecate their usage all together. +execution paths and deprecate their usage altogether. ```go type Manager struct { diff --git a/docs/architecture/adr-069-gov-improvements.md b/docs/architecture/adr-069-gov-improvements.md index d87ae571d2c6..17f7f31841e2 100644 --- a/docs/architecture/adr-069-gov-improvements.md +++ b/docs/architecture/adr-069-gov-improvements.md @@ -19,7 +19,7 @@ Those two types are, namely: multiple choice proposals and optimistic proposals. ## Context `x/gov` is the center of Cosmos governance, and has already been improved from its first version `v1beta1`, with a second version [`v1`][5]. -This second iteration on gov unlocked many possibilities by letting governance proposals contain any number of proposals. +This second iteration of gov unlocked many possibilities by letting governance proposals contain any number of proposals. The last addition of gov has been expedited proposals (proposals that have a shorter voting period and a higher quorum, approval threshold). The community requested ([1], [4]) two additional proposals for improving governance choices. Those proposals would be useful when having protocol decisions made on specific choices or simplifying regular proposals that do not require high community involvement. @@ -66,7 +66,7 @@ Voter can only vote NO on the proposal. If the NO threshold is reached, the opti Two governance parameters will be in added [`v1.Params`][5] to support optimistic proposals: ```protobuf -// optimistic_authorized_addreses is an optional governance parameter that limits the authorized accounts than can submit optimisitc proposals +// optimistic_authorized_addreses is an optional governance parameter that limits the authorized accounts that can submit optimistic proposals repeated string optimistic_authorized_addreses = 17 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // Optimistic rejected threshold defines at which percentage of NO votes, the optimistic proposal should fail and be converted to a standard proposal. @@ -77,8 +77,8 @@ string optimistic_rejected_threshold = 18 [(cosmos_proto.scalar) = "cosmos.Dec"] A multiple choice proposal is a proposal where the voting options can be defined by the proposer. -The number of voting option will be limited to a maximum of 4. -A new vote option `SPAM` will be added and distinguished of those voting options. `SPAM` will be used to mark a proposal as spam and is explained further below. +The number of voting options will be limited to a maximum of 4. +A new vote option `SPAM` will be added and distinguished from those voting options. `SPAM` will be used to mark a proposal as spam and is explained further below. Multiple choice proposals, contrary to any other proposal type, cannot have messages to execute. They are only text proposals. diff --git a/docs/architecture/adr-070-unordered-account.md b/docs/architecture/adr-070-unordered-account.md new file mode 100644 index 000000000000..814193cef668 --- /dev/null +++ b/docs/architecture/adr-070-unordered-account.md @@ -0,0 +1,260 @@ +# ADR 070: Un-Ordered Transaction Inclusion + +## Changelog + +* Dec 4, 2023: Initial Draft + +## Status + +ACCEPTED + +## Abstract + +We propose a way to do replay-attack protection without enforcing the order of +transactions, without requiring the use of nonces. In this way, we can support +un-ordered transaction inclusion. + +## Context + +As of today, the nonce value (account sequence number) prevents replay-attack and +ensures the transactions from the same sender are included into blocks and executed +in sequential order. However it makes it tricky to send many transactions from the +same sender concurrently in a reliable way. IBC relayer and crypto exchanges are +typical examples of such use cases. + +## Decision + +We propose to add a boolean field `unordered` to transaction body to mark "un-ordered" +transactions. + +Un-ordered transactions will bypass the nonce rules and follow the rules described +below instead, in contrary, the default ordered transactions are not impacted by +this proposal, they'll follow the nonce rules the same as before. + +When an un-ordered transaction is included into a block, the transaction hash is +recorded in a dictionary. New transactions are checked against this dictionary for +duplicates, and to prevent the dictionary grow indefinitely, the transaction must +specify `timeout_height` for expiration, so it's safe to removed it from the +dictionary after it's expired. + +The dictionary can be simply implemented as an in-memory golang map, a preliminary +analysis shows that the memory consumption won't be too big, for example `32M = 32 * 1024 * 1024` +can support 1024 blocks where each block contains 1024 unordered transactions. For +safety, we should limit the range of `timeout_height` to prevent very long expiration, +and limit the size of the dictionary. + +### Transaction Format + +```protobuf +message TxBody { + ... + + bool unordered = 4; +} +``` + +### `DedupTxHashManager` + +```golang +const PurgeLoopSleepMS = 500 + +// DedupTxHashManager contains the tx hash dictionary for duplicates checking, +// and expire them when block number progresses. +type DedupTxHashManager struct { + mutex sync.RWMutex + // tx hash -> expire block number + // for duplicates checking and expiration + hashes map[TxHash]uint64 + // channel to receive latest block numbers + blockCh chan uint64 +} + +func NewDedupTxHashManager() *DedupTxHashManager { + m := &DedupTxHashManager{ + hashes: make(map[TxHash]uint64), + blockCh: make(ch *uint64, 16), + } + go m.purgeLoop() + return m +} + +func (dtm *DedupTxHashManager) Close() error { + close(dtm.blockCh) + dtm.blockCh = nil + return nil +} + +func (dtm *DedupTxHashManager) Contains(hash TxHash) (ok bool) { + dtm.mutex.RLock() + defer dtm.mutex.RUnlock() + + _, ok = dtm.hashes[hash] + return +} + +func (dtm *DedupTxHashManager) Size() int { + dtm.mutex.RLock() + defer dtm.mutex.RUnlock() + + return len(dtm.hashes) +} + +func (dtm *DedupTxHashManager) Add(hash TxHash, expire uint64) (ok bool) { + dtm.mutex.Lock() + defer dtm.mutex.Unlock() + + dtm.hashes[hash] = expire + return +} + +// OnNewBlock send the latest block number to the background purge loop, +// it should be called in abci commit event. +func (dtm *DedupTxHashManager) OnNewBlock(blockNumber uint64) { + dtm.blockCh <- &blockNumber +} + +// purgeLoop removes expired tx hashes at background +func (dtm *DedupTxHashManager) purgeLoop() error { + for { + blocks := channelBatchRecv(dtm.blockCh) + if len(blocks) == 0 { + // channel closed + break + } + + latest := *blocks[len(blocks)-1] + hashes := dtm.expired(latest) + if len(hashes) > 0 { + dtm.purge(hashes) + } + + // avoid burning cpu in catching up phase + time.Sleep(PurgeLoopSleepMS * time.Millisecond) + } +} + +// expired find out expired tx hashes based on latest block number +func (dtm *DedupTxHashManager) expired(block uint64) []TxHash { + dtm.mutex.RLock() + defer dtm.mutex.RUnlock() + + var result []TxHash + for h, expire := range dtm.hashes { + if block > expire { + result = append(result, h) + } + } + return result +} + +func (dtm *DedupTxHashManager) purge(hashes []TxHash) { + dtm.mutex.Lock() + defer dtm.mutex.Unlock() + + for _, hash := range hashes { + delete(dtm.hashes, hash) + } +} + +// channelBatchRecv try to exhaust the channel buffer when it's not empty, +// and block when it's empty. +func channelBatchRecv[T any](ch <-chan *T) []*T { + item := <-ch // block if channel is empty + if item == nil { + // channel is closed + return nil + } + + remaining := len(ch) + result := make([]*T, 0, remaining+1) + result = append(result, item) + for i := 0; i < remaining; i++ { + result = append(result, <-ch) + } + + return result +} +``` + +### Ante Handlers + +Bypass the nonce decorator for un-ordered transactions. + +```golang +func (isd IncrementSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + if tx.UnOrdered() { + return next(ctx, tx, simulate) + } + + // the previous logic +} +``` + +A decorator for the new logic. + +```golang +type TxHash [32]byte + +const ( + // MaxUnOrderedTTL defines the maximum ttl an un-order tx can set + MaxUnOrderedTTL = 1024 +) + +type DedupTxDecorator struct { + m *DedupTxHashManager +} + +func (dtd *DedupTxDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + // only apply to un-ordered transactions + if !tx.UnOrdered() { + return next(ctx, tx, simulate) + } + + if tx.TimeoutHeight() == 0 { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "unordered tx must set timeout-height") + } + + if tx.TimeoutHeight() > ctx.BlockHeight() + MaxUnOrderedTTL { + return nil, errorsmod.Wrapf(sdkerrors.ErrLogic, "unordered tx ttl exceeds %d", MaxUnOrderedTTL) + } + + // check for duplicates + if dtd.m.Contains(tx.Hash()) { + return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "tx is duplicated") + } + + if !ctx.IsCheckTx() { + // a new tx included in the block, add the hash to the dictionary + dtd.m.Add(tx.Hash(), tx.TimeoutHeight()) + } + + return next(ctx, tx, simulate) +} +``` + +### `OnNewBlock` + +Wire the `OnNewBlock` method of `DedupTxHashManager` into the BaseApp's ABCI Commit event. + +### Start Up + +On start up, the node needs to re-fill the tx hash dictionary of `DedupTxHashManager` +by scanning `MaxUnOrderedTTL` number of historical blocks for existing un-expired +un-ordered transactions. + +An alternative design is to store the tx hash dictionary in kv store, then no need +to warm up on start up. + +## Consequences + +### Positive + +* Support un-ordered and concurrent transaction inclusion. + +### Negative + +* Start up overhead to scan historical blocks. + +## References + +* https://github.com/cosmos/cosmos-sdk/issues/13009 diff --git a/docs/build/building-modules/01-module-manager.md b/docs/build/building-modules/01-module-manager.md index dfd17d5f5536..e0ab0e54f02f 100644 --- a/docs/build/building-modules/01-module-manager.md +++ b/docs/build/building-modules/01-module-manager.md @@ -273,7 +273,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/types/module/module.go It implements the following methods: * `NewBasicManager(modules ...AppModuleBasic)`: Constructor function. It takes a list of the application's `AppModuleBasic` and builds a new `BasicManager`. This function is generally called in the `init()` function of [`app.go`](../../learn/beginner/00-app-anatomy.md#core-application-file) to quickly initialize the independent elements of the application's modules (click [here](https://github.com/cosmos/gaia/blob/main/app/app.go#L59-L74) to see an example). -* `NewBasicManagerFromManager(manager *Manager, customModuleBasics map[string]AppModuleBasic)`: Contructor function. It creates a new `BasicManager` from a `Manager`. The `BasicManager` will contain all `AppModuleBasic` from the `AppModule` manager using `CoreAppModuleBasicAdaptor` whenever possible. Module's `AppModuleBasic` can be overridden by passing a custom AppModuleBasic map +* `NewBasicManagerFromManager(manager *Manager, customModuleBasics map[string]AppModuleBasic)`: Constructor function. It creates a new `BasicManager` from a `Manager`. The `BasicManager` will contain all `AppModuleBasic` from the `AppModule` manager using `CoreAppModuleBasicAdaptor` whenever possible. Module's `AppModuleBasic` can be overridden by passing a custom AppModuleBasic map * `RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)`: Registers the [`codec.LegacyAmino`s](../../learn/advanced/05-encoding.md#amino) of each of the application's `AppModuleBasic`. This function is usually called early on in the [application's construction](../../learn/beginner/00-app-anatomy.md#constructor). * `RegisterInterfaces(registry codectypes.InterfaceRegistry)`: Registers interface types and implementations of each of the application's `AppModuleBasic`. * `DefaultGenesis(cdc codec.JSONCodec)`: Provides default genesis information for modules in the application by calling the [`DefaultGenesis(cdc codec.JSONCodec)`](./08-genesis.md#defaultgenesis) function of each module. It only calls the modules that implements the `HasGenesisBasics` interfaces. diff --git a/docs/learn/advanced/01-transactions.md b/docs/learn/advanced/01-transactions.md index c2d779a8306b..15f06dec8dd4 100644 --- a/docs/learn/advanced/01-transactions.md +++ b/docs/learn/advanced/01-transactions.md @@ -81,7 +81,7 @@ The Cosmos SDK also provides a couple of other sign modes for particular use cas #### `SIGN_MODE_DIRECT_AUX` -`SIGN_MODE_DIRECT_AUX` is a sign mode released in the Cosmos SDK v0.46 which targets transactions with multiple signers. Whereas `SIGN_MODE_DIRECT` expects each signer to sign over both `TxBody` and `AuthInfo` (which includes all other signers' signer infos, i.e. their account sequence, public key and mode info), `SIGN_MODE_DIRECT_AUX` allows N-1 signers to only sign over `TxBody` and _their own_ signer info. Morever, each auxiliary signer (i.e. a signer using `SIGN_MODE_DIRECT_AUX`) doesn't +`SIGN_MODE_DIRECT_AUX` is a sign mode released in the Cosmos SDK v0.46 which targets transactions with multiple signers. Whereas `SIGN_MODE_DIRECT` expects each signer to sign over both `TxBody` and `AuthInfo` (which includes all other signers' signer infos, i.e. their account sequence, public key and mode info), `SIGN_MODE_DIRECT_AUX` allows N-1 signers to only sign over `TxBody` and _their own_ signer info. Moreover, each auxiliary signer (i.e. a signer using `SIGN_MODE_DIRECT_AUX`) doesn't need to sign over the fees: ```protobuf reference diff --git a/docs/learn/advanced/07-cli.md b/docs/learn/advanced/07-cli.md index efc3b638c0c8..adfcaf14393a 100644 --- a/docs/learn/advanced/07-cli.md +++ b/docs/learn/advanced/07-cli.md @@ -71,7 +71,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/simd/cmd/root_v :::tip Use the `EnhanceRootCommand()` from the AutoCLI options to automatically add auto-generated commands from the modules to the root command. -Additionnally it adds all manually defined modules commands (`tx` and `query`) as well. +Additionally it adds all manually defined modules commands (`tx` and `query`) as well. Read more about [AutoCLI](https://docs.cosmos.network/main/core/autocli) in its dedicated section. ::: diff --git a/docs/learn/advanced/11-runtx_middleware.md b/docs/learn/advanced/11-runtx_middleware.md index f083a77888e5..a454ee382c26 100644 --- a/docs/learn/advanced/11-runtx_middleware.md +++ b/docs/learn/advanced/11-runtx_middleware.md @@ -4,7 +4,7 @@ sidebar_position: 1 # RunTx recovery middleware -`BaseApp.runTx()` function handles Go panics that might occur during transactions execution, for example, keeper has faced an invalid state and paniced. +`BaseApp.runTx()` function handles Go panics that might occur during transactions execution, for example, keeper has faced an invalid state and panicked. Depending on the panic type different handler is used, for instance the default one prints an error log message. Recovery middleware is used to add custom panic recovery for Cosmos SDK application developers. diff --git a/docs/rfc/rfc-001-tx-validation.md b/docs/rfc/rfc-001-tx-validation.md index 923e1c720a2a..e616c6feabe7 100644 --- a/docs/rfc/rfc-001-tx-validation.md +++ b/docs/rfc/rfc-001-tx-validation.md @@ -16,7 +16,7 @@ With the separation of CometBFT and Cosmos-SDK, there is a lack of control of wh The acceptance of this RFC would move validation within `ValidateBasic` to the message server in modules, update tutorials and docs to remove mention of using `ValidateBasic` in favour of handling all validation for a message where it is executed. -We can and will still support the `Validatebasic` function for users and provide an extension interface of the function once `sdk.Msg` is depreacted. +We can and will still support the `Validatebasic` function for users and provide an extension interface of the function once `sdk.Msg` is deprecated. > Note: This is how messages are handled in VMs like Ethereum and CosmWasm. diff --git a/docs/rfc/rfc-template.md b/docs/rfc/rfc-template.md index 417a795d08dc..f4e79fbb4ec3 100644 --- a/docs/rfc/rfc-template.md +++ b/docs/rfc/rfc-template.md @@ -32,7 +32,7 @@ > path and fall into the same pitfalls that we've since matured from. Abandoned ideas are a way to recognize that path > and explain the pitfalls and why they were abandoned. -## Descision +## Decision > This section describes alternative designs to the chosen design. This section > is important and if an adr does not have any alternatives then it should be diff --git a/docs/spec/SPEC_MODULE.md b/docs/spec/SPEC_MODULE.md index 1b5e5d5dc65f..275d17a5c42e 100644 --- a/docs/spec/SPEC_MODULE.md +++ b/docs/spec/SPEC_MODULE.md @@ -24,7 +24,7 @@ specifications for modules. The following list is nonbinding and all sections ar * `# {Module Name}` - overview of the module * `## Concepts` - describe specialized concepts and definitions used throughout the spec -* `## State` - specify and describe structures expected to marshalled into the store, and their keys +* `## State` - specify and describe structures expected to be marshalled into the store, and their keys * `## State Transitions` - standard state transition operations triggered by hooks, messages, etc. * `## Messages` - specify message structure(s) and expected state machine behaviour(s) * `## Begin Block` - specify any begin-block operations diff --git a/docs/spec/SPEC_STANDARD.md b/docs/spec/SPEC_STANDARD.md index 3608b3654c0b..f6dc07b852f5 100644 --- a/docs/spec/SPEC_STANDARD.md +++ b/docs/spec/SPEC_STANDARD.md @@ -42,7 +42,7 @@ This section should include an assumptions sub-section if any, the mandatory pro This is the main section of the document, and should contain protocol documentation, design rationale, required references, and technical details where appropriate. The section may have any or all of the following sub-sections, as appropriate to the particular specification. The API sub-section is especially encouraged when appropriate. -* *API* - A detailed description of the features's API. +* *API* - A detailed description of the feature's API. * *Technical Details* - All technical details including syntax, diagrams, semantics, protocols, data structures, algorithms, and pseudocode as appropriate. The technical specification should be detailed enough such that separate correct implementations of the specification without knowledge of each other are compatible. * *Backwards Compatibility* - A discussion of compatibility (or lack thereof) with previous feature or protocol versions. * *Known Issues* - A list of known issues. This sub-section is specially important for specifications of already in-use features. diff --git a/docs/spec/addresses/bech32.md b/docs/spec/addresses/bech32.md index 2c15bac689bf..626dfd11d3aa 100644 --- a/docs/spec/addresses/bech32.md +++ b/docs/spec/addresses/bech32.md @@ -16,6 +16,6 @@ In the Cosmos network, keys and addresses may refer to a number of different rol While all user facing interfaces to Cosmos software should exposed Bech32 interfaces, many internal interfaces encode binary value in hex or base64 encoded form. -To covert between other binary representation of addresses and keys, it is important to first apply the Amino encoding process before Bech32 encoding. +To convert between other binary representation of addresses and keys, it is important to first apply the Amino encoding process before Bech32 encoding. A complete implementation of the Amino serialization format is unnecessary in most cases. Simply prepending bytes from this [table](https://github.com/cometbft/cometbft/blob/main/spec/blockchain/encoding.md) to the byte string payload before Bech32 encoding will sufficient for compatible representation. diff --git a/docs/spec/fee_distribution/f1_fee_distr.tex b/docs/spec/fee_distribution/f1_fee_distr.tex index b6bb6b3265a2..4bcfc7718b0e 100644 --- a/docs/spec/fee_distribution/f1_fee_distr.tex +++ b/docs/spec/fee_distribution/f1_fee_distr.tex @@ -102,7 +102,7 @@ \subsection{Slashing} The solution here is to instead store each period created by a slash in the validators state. Then when withdrawing, you must iterate over all slashes between when you started and ended. -Suppose you delegated at period $0$, a y\% slash occured at period $2$, and your withdrawal creates period $4$. +Suppose you delegated at period $0$, a y\% slash occurred at period $2$, and your withdrawal creates period $4$. Then you receive funds from periods $0$ to $2$ as normal. The equations for funds you receive for periods $2$ to $4$ now uses $(1 - y)x$ for your stake instead of just $x$ stake. When there are multiple slashes, you just account for the accumulated slash factor. @@ -110,7 +110,7 @@ \subsection{Slashing} In practice this will not really be an efficiency hit, as the number of slashes is expected to be 0 or 1 for most validators. Validators that get slashed more will naturally lose their delegators. A malicious validator that gets itself slashed many times would increase the gas to withdraw linearly, but the economic loss of funds due to the slashes is expected to far out-weigh the extra overhead the honest withdrawer must pay for due to the gas. -(TODO: frame that above sentence in terms of griefing factors, as thats more correct) +(TODO: frame that above sentence in terms of griefing factors, as that's more correct) \subsection{Inflation} Inflation is the idea that we want every staked coin to create more staking tokens as time progresses. diff --git a/docs/spec/store/README.md b/docs/spec/store/README.md index c53d69c67d03..d9d35e7d465c 100644 --- a/docs/spec/store/README.md +++ b/docs/spec/store/README.md @@ -29,7 +29,7 @@ with, which also provides the basis of most state storage and commitment operati is the `KVStore`. The `KVStore` interface provides basic CRUD abilities and prefix-based iteration, including reverse iteration. -Typically, each module has it's own dedicated `KVStore` instance, which it can +Typically, each module has its own dedicated `KVStore` instance, which it can get access to via the `sdk.Context` and the use of a pointer-based named key -- `KVStoreKey`. The `KVStoreKey` provides pseudo-OCAP. How a exactly a `KVStoreKey` maps to a `KVStore` will be illustrated below through the `CommitMultiStore`. @@ -42,7 +42,7 @@ until `Commit()` is called on the `CommitMultiStore`. ### `CommitMultiStore` -The `CommitMultiStore` interface exposes the the top-level interface that is used +The `CommitMultiStore` interface exposes the top-level interface that is used to manage state commitment and storage by an SDK application and abstracts the concept of multiple `KVStore`s which are used by multiple modules. Specifically, it supports the following high-level primitives: @@ -53,7 +53,7 @@ it supports the following high-level primitives: * Allows for loading state storage at a particular height/version in the past to provide current head and historical queries. * Provides the ability to rollback state to a previous height/version. -* Provides the ability to to load state storage at a particular height/version +* Provides the ability to load state storage at a particular height/version while also performing store upgrades, which are used during live hard-fork application state migrations. * Provides the ability to commit all current accumulated state to disk and performs diff --git a/go.mod b/go.mod index bc76c825e33a..6fda05c9bd1e 100644 --- a/go.mod +++ b/go.mod @@ -43,6 +43,7 @@ require ( github.com/magiconair/properties v1.8.7 github.com/mattn/go-isatty v0.0.20 github.com/mdp/qrterminal/v3 v3.2.0 + github.com/muesli/termenv v0.15.2 github.com/prometheus/client_golang v1.17.0 github.com/prometheus/common v0.45.0 github.com/rs/zerolog v1.31.0 @@ -52,6 +53,7 @@ require ( github.com/spf13/viper v1.17.0 github.com/stretchr/testify v1.8.4 github.com/tendermint/go-amino v0.16.0 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b golang.org/x/crypto v0.16.0 golang.org/x/exp v0.0.0-20231127185646-65229373498e golang.org/x/sync v0.5.0 @@ -66,7 +68,10 @@ require ( require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/bufbuild/protocompile v0.6.0 // indirect @@ -119,7 +124,9 @@ require ( github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.8.6 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect @@ -128,13 +135,14 @@ require ( github.com/nxadm/tail v1.4.8 // 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // 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_model v0.5.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect @@ -147,12 +155,15 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 3975df60b4be..f3d1364cfeae 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -95,6 +97,8 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -530,6 +534,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.8.6 h1:O7I6SIGPrypf3f/gmrrLUBQDKfO8uOoYdWf4gLS06tc= github.com/linxGnu/grocksdb v1.8.6/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/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= @@ -548,6 +554,8 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 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= @@ -577,6 +585,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G 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/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= +github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= 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= @@ -633,8 +643,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -689,6 +699,8 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c 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/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 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= @@ -798,6 +810,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/internal/conv/doc.go b/internal/conv/doc.go index 1c86f5c14409..4b45d1ab53f9 100644 --- a/internal/conv/doc.go +++ b/internal/conv/doc.go @@ -1,2 +1,2 @@ -// Package conv provides internal functions for convertions and data manipulation +// Package conv provides internal functions for conversions and data manipulation package conv diff --git a/math/dec.go b/math/dec.go index 4de74b0b377c..58abb9ca1a99 100644 --- a/math/dec.go +++ b/math/dec.go @@ -725,7 +725,7 @@ func (d LegacyDec) TruncateDec() LegacyDec { return LegacyNewDecFromBigInt(chopPrecisionAndTruncateNonMutative(d.i)) } -// Ceil returns the smallest interger value (as a decimal) that is greater than +// Ceil returns the smallest integer value (as a decimal) that is greater than // or equal to the given decimal. func (d LegacyDec) Ceil() LegacyDec { tmp := new(big.Int).Set(d.i) diff --git a/orm/README.md b/orm/README.md index 14bc84b8812a..0886439e429c 100644 --- a/orm/README.md +++ b/orm/README.md @@ -269,9 +269,9 @@ type BalanceTable interface { Update(ctx context.Context, balance *Balance) error Save(ctx context.Context, balance *Balance) error Delete(ctx context.Context, balance *Balance) error - Has(ctx context.Context, acocunt []byte, denom string) (found bool, err error) + Has(ctx context.Context, account []byte, denom string) (found bool, err error) // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. - Get(ctx context.Context, acocunt []byte, denom string) (*Balance, error) + Get(ctx context.Context, account []byte, denom string) (*Balance, error) List(ctx context.Context, prefixKey BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error) ListRange(ctx context.Context, from, to BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error) DeleteBy(ctx context.Context, prefixKey BalanceIndexKey) error diff --git a/proto/buf.yaml b/proto/buf.yaml index 4e05b2f00335..cebaa25e5ce2 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -20,5 +20,6 @@ lint: - SERVICE_SUFFIX - PACKAGE_VERSION_SUFFIX - RPC_REQUEST_STANDARD_NAME + - ENUM_NO_ALLOW_ALIAS ignore: - tendermint diff --git a/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto b/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto index 098448d61809..20203e13af4f 100644 --- a/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto +++ b/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto @@ -5,6 +5,8 @@ package cosmos.accounts.interfaces.account_abstraction.v1; import "google/protobuf/any.proto"; import "cosmos/accounts/v1/account_abstraction.proto"; +option go_package = "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1"; + // MsgAuthenticate is a message that an x/account account abstraction implementer // must handle to authenticate a state transition. message MsgAuthenticate { diff --git a/proto/cosmos/accounts/testing/counter/v1/counter.proto b/proto/cosmos/accounts/testing/counter/v1/counter.proto index 560e66ebb81d..1985757e1a61 100644 --- a/proto/cosmos/accounts/testing/counter/v1/counter.proto +++ b/proto/cosmos/accounts/testing/counter/v1/counter.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package cosmos.accounts.testing.counter.v1; +option go_package = "cosmossdk.io/x/accounts/testing/counter/v1"; + // MsgInit defines a message which initializes the counter with a given amount. message MsgInit { // initial_value is the initial amount to set the counter to. diff --git a/proto/cosmos/accounts/testing/rotation/v1/partial.proto b/proto/cosmos/accounts/testing/rotation/v1/partial.proto index 9e41d94a06a4..46fc2f4fb82f 100644 --- a/proto/cosmos/accounts/testing/rotation/v1/partial.proto +++ b/proto/cosmos/accounts/testing/rotation/v1/partial.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package cosmos.accounts.testing.rotation.v1; +option go_package = "cosmossdk.io/x/accounts/testing/rotation/v1"; + // MsgInit is the init message used to create a new account // abstraction implementation that we use for testing, this account // also allows for rotating the public key. diff --git a/proto/cosmos/accounts/v1/genesis.proto b/proto/cosmos/accounts/v1/genesis.proto index 333b276f37d3..83e9dc385b44 100644 --- a/proto/cosmos/accounts/v1/genesis.proto +++ b/proto/cosmos/accounts/v1/genesis.proto @@ -18,8 +18,10 @@ message GenesisAccount { string address = 1; // account_type is the account type of the account. string account_type = 2; + // account_number is the account number of the account. + uint64 account_number = 3; // state is the account state represented as a slice of raw key value byte pairs. - repeated KVPair state = 3; + repeated KVPair state = 4; } // KVPair defines a key value pair. diff --git a/proto/cosmos/accounts/v1/query.proto b/proto/cosmos/accounts/v1/query.proto index c6bcee86fa3b..d2b5d55ccfae 100644 --- a/proto/cosmos/accounts/v1/query.proto +++ b/proto/cosmos/accounts/v1/query.proto @@ -4,6 +4,8 @@ package cosmos.accounts.v1; option go_package = "cosmossdk.io/x/accounts/v1"; +import "google/protobuf/any.proto"; + // Query defines the Query service for the x/accounts module. service Query { // AccountQuery runs an account query. @@ -19,13 +21,13 @@ message AccountQueryRequest { // target defines the account to be queried. string target = 1; // request defines the query message being sent to the account. - bytes request = 2; + google.protobuf.Any request = 2; } // AccountQueryResponse is the response type for the Query/AccountQuery RPC method. message AccountQueryResponse { // response defines the query response of the account. - bytes response = 1; + google.protobuf.Any response = 1; } // SchemaResponse is the response type for the Query/Schema RPC method. diff --git a/proto/cosmos/accounts/v1/tx.proto b/proto/cosmos/accounts/v1/tx.proto index 2ab9000871d8..0e5460ece817 100644 --- a/proto/cosmos/accounts/v1/tx.proto +++ b/proto/cosmos/accounts/v1/tx.proto @@ -4,6 +4,7 @@ package cosmos.accounts.v1; option go_package = "cosmossdk.io/x/accounts/v1"; +import "google/protobuf/any.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos/accounts/v1/account_abstraction.proto"; @@ -30,10 +31,8 @@ message MsgInit { string sender = 1; // account_type is the type of the account to be created. string account_type = 2; - // message is the message to be sent to the account, it's up to the account - // implementation to decide what encoding format should be used to interpret - // this message. - bytes message = 3; + // message is the message to be sent to the account. + google.protobuf.Any message = 3; } // MsgInitResponse defines the Create response type for the Msg/Create RPC method. @@ -41,7 +40,7 @@ message MsgInitResponse { // account_address is the address of the newly created account. string account_address = 1; // response is the response returned by the account implementation. - bytes response = 2; + google.protobuf.Any response = 2; } // MsgExecute defines the Execute request type for the Msg/Execute RPC method. @@ -51,14 +50,14 @@ message MsgExecute { string sender = 1; // target is the address of the account to be executed. string target = 2; - // message is the message to be sent to the account, it's up to the account - bytes message = 3; + // message is the message to be sent to the account. + google.protobuf.Any message = 3; } // MsgExecuteResponse defines the Execute response type for the Msg/Execute RPC method. message MsgExecuteResponse { // response is the response returned by the account implementation. - bytes response = 1; + google.protobuf.Any response = 1; } // -------- Account Abstraction --------- diff --git a/proto/cosmos/authz/v1beta1/event.proto b/proto/cosmos/authz/v1beta1/event.proto index d39aa5822982..a07c1534390b 100644 --- a/proto/cosmos/authz/v1beta1/event.proto +++ b/proto/cosmos/authz/v1beta1/event.proto @@ -8,7 +8,7 @@ option go_package = "cosmossdk.io/x/authz"; // EventGrant is emitted on Msg/Grant message EventGrant { - // Msg type URL for which an autorization is granted + // Msg type URL for which an authorization is granted string msg_type_url = 2; // Granter account address string granter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -18,7 +18,7 @@ message EventGrant { // EventRevoke is emitted on Msg/Revoke message EventRevoke { - // Msg type URL for which an autorization is revoked + // Msg type URL for which an authorization is revoked string msg_type_url = 2; // Granter account address string granter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; diff --git a/proto/cosmos/base/reflection/v2alpha1/reflection.proto b/proto/cosmos/base/reflection/v2alpha1/reflection.proto index d5b048558fa0..ec8bf2f1d805 100644 --- a/proto/cosmos/base/reflection/v2alpha1/reflection.proto +++ b/proto/cosmos/base/reflection/v2alpha1/reflection.proto @@ -17,7 +17,7 @@ message AppDescriptor { CodecDescriptor codec = 3; // configuration provides metadata information regarding the sdk.Config type ConfigurationDescriptor configuration = 4; - // query_services provides metadata information regarding the available queriable endpoints + // query_services provides metadata information regarding the available queryable endpoints QueryServicesDescriptor query_services = 5; // tx provides metadata information regarding how to send transactions to the given application TxDescriptor tx = 6; @@ -190,7 +190,7 @@ message GetTxDescriptorResponse { TxDescriptor tx = 1; } -// QueryServicesDescriptor contains the list of cosmos-sdk queriable services +// QueryServicesDescriptor contains the list of cosmos-sdk queryable services message QueryServicesDescriptor { // query_services is a list of cosmos-sdk QueryServiceDescriptor repeated QueryServiceDescriptor query_services = 1; diff --git a/proto/cosmos/gov/v1/genesis.proto b/proto/cosmos/gov/v1/genesis.proto index d6dd5109051e..1df3b98022ef 100644 --- a/proto/cosmos/gov/v1/genesis.proto +++ b/proto/cosmos/gov/v1/genesis.proto @@ -18,15 +18,15 @@ message GenesisState { // proposals defines all the proposals present at genesis. repeated Proposal proposals = 4; // Deprecated: Prefer to use `params` instead. - // deposit_params defines all the paramaters of related to deposit. + // deposit_params defines all the parameters of related to deposit. DepositParams deposit_params = 5 [deprecated = true]; // Deprecated: Prefer to use `params` instead. - // voting_params defines all the paramaters of related to voting. + // voting_params defines all the parameters of related to voting. VotingParams voting_params = 6 [deprecated = true]; // Deprecated: Prefer to use `params` instead. - // tally_params defines all the paramaters of related to tally. + // tally_params defines all the parameters of related to tally. TallyParams tally_params = 7 [deprecated = true]; - // params defines all the paramaters of x/gov module. + // params defines all the parameters of x/gov module. // // Since: cosmos-sdk 0.47 Params params = 8; diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index 8ab849500d00..e270086ab2ae 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -12,18 +12,45 @@ import "amino/amino.proto"; option go_package = "cosmossdk.io/x/gov/types/v1"; +// ProposalType enumerates the valid proposal types. +// All proposal types are v1.Proposal which have different voting periods or tallying logic. +enum ProposalType { + // PROPOSAL_TYPE_UNSPECIFIED defines no proposal type, which fallback to PROPOSAL_TYPE_STANDARD. + PROPOSAL_TYPE_UNSPECIFIED = 0; + // PROPOSAL_TYPE_STANDARD defines the type for a standard proposal. + PROPOSAL_TYPE_STANDARD = 1; + // PROPOSAL_TYPE_MULTIPLE_CHOICE defines the type for a multiple choice proposal. + PROPOSAL_TYPE_MULTIPLE_CHOICE = 2; + // PROPOSAL_TYPE_OPTIMISTIC defines the type for an optimistic proposal. + PROPOSAL_TYPE_OPTIMISTIC = 3; + // PROPOSAL_TYPE_EXPEDITED defines the type for an expedited proposal. + PROPOSAL_TYPE_EXPEDITED = 4; +} + // VoteOption enumerates the valid vote options for a given governance proposal. enum VoteOption { + option allow_alias = true; + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. VOTE_OPTION_UNSPECIFIED = 0; - // VOTE_OPTION_YES defines a yes vote option. + // VOTE_OPTION_ONE defines the first proposal vote option. + VOTE_OPTION_ONE = 1; + // VOTE_OPTION_YES defines the yes proposal vote option. VOTE_OPTION_YES = 1; - // VOTE_OPTION_ABSTAIN defines an abstain vote option. + // VOTE_OPTION_TWO defines the second proposal vote option. + VOTE_OPTION_TWO = 2; + // VOTE_OPTION_ABSTAIN defines the abstain proposal vote option. VOTE_OPTION_ABSTAIN = 2; - // VOTE_OPTION_NO defines a no vote option. + // VOTE_OPTION_THREE defines the third proposal vote option. + VOTE_OPTION_THREE = 3; + // VOTE_OPTION_NO defines the no proposal vote option. VOTE_OPTION_NO = 3; - // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + // VOTE_OPTION_FOUR defines the fourth proposal vote option. + VOTE_OPTION_FOUR = 4; + // VOTE_OPTION_NO_WITH_VETO defines the no with veto proposal vote option. VOTE_OPTION_NO_WITH_VETO = 4; + // VOTE_OPTION_SPAM defines the spam proposal vote option. + VOTE_OPTION_SPAM = 5; } // WeightedVoteOption defines a unit of vote for vote split. @@ -102,12 +129,18 @@ message Proposal { // expedited defines if the proposal is expedited // // Since: cosmos-sdk 0.50 - bool expedited = 14; + // Deprecated: Use ProposalType instead. + bool expedited = 14 [deprecated = true]; // failed_reason defines the reason why the proposal failed // // Since: cosmos-sdk 0.50 string failed_reason = 15; + + // proposal_type defines the type of the proposal + // + // Since: cosmos-sdk 0.51 + ProposalType proposal_type = 16; } // ProposalStatus enumerates the valid statuses of a proposal. @@ -134,13 +167,15 @@ enum ProposalStatus { // TallyResult defines a standard tally for a governance proposal. message TallyResult { // yes_count is the number of yes votes on a proposal. - string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; + string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; // option 1 // abstain_count is the number of abstain votes on a proposal. - string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; + string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; // option 2 // no_count is the number of no votes on a proposal. - string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; + string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; // option 3 // no_with_veto_count is the number of no with veto votes on a proposal. - string no_with_veto_count = 4 [(cosmos_proto.scalar) = "cosmos.Int"]; + string no_with_veto_count = 4 [(cosmos_proto.scalar) = "cosmos.Int"]; // option 4 + // spam_count is the number of spam votes on a proposal. + string spam_count = 5 [(cosmos_proto.scalar) = "cosmos.Int"]; } // Vote defines a vote on a governance proposal. diff --git a/proto/cosmos/gov/v1/query.proto b/proto/cosmos/gov/v1/query.proto index 33e77071e87f..2477c8a58a69 100644 --- a/proto/cosmos/gov/v1/query.proto +++ b/proto/cosmos/gov/v1/query.proto @@ -153,7 +153,7 @@ message QueryParamsResponse { // Deprecated: Prefer to use `params` instead. // tally_params defines the parameters related to tally. TallyParams tally_params = 3 [deprecated = true]; - // params defines all the paramaters of x/gov module. + // params defines all the parameters of x/gov module. // // Since: cosmos-sdk 0.47 Params params = 4; diff --git a/proto/cosmos/gov/v1/tx.proto b/proto/cosmos/gov/v1/tx.proto index 7519a74d1d9e..78577d443d21 100644 --- a/proto/cosmos/gov/v1/tx.proto +++ b/proto/cosmos/gov/v1/tx.proto @@ -81,7 +81,16 @@ message MsgSubmitProposal { // expedited defines if the proposal is expedited or not // // Since: cosmos-sdk 0.50 - bool expedited = 7; + // Deprecated: Use the PROPOSAL_TYPE_EXPEDITED proposal type instead. + // When this field is set and no proposal_type is set, the proposal_type + // will be set to PROPOSAL_TYPE_EXPEDITED for backwards compatibility. + bool expedited = 7 [deprecated = true]; + + // proposal_type defines the type of proposal + // When not set defaults to PROPOSAL_TYPE_STANDARD + // + // Since: cosmos-sdk 0.51 + ProposalType proposal_type = 8; } // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. diff --git a/proto/cosmos/msg/textual/v1/textual.proto b/proto/cosmos/msg/textual/v1/textual.proto index 4f8cd141b067..63f71d5b662c 100644 --- a/proto/cosmos/msg/textual/v1/textual.proto +++ b/proto/cosmos/msg/textual/v1/textual.proto @@ -9,7 +9,7 @@ extend google.protobuf.MessageOptions { // algorithm used to generate the custom textual representation of the // protobuf message where this annotation is applied. We recommend to use a // short, versioned name as this identifier, e.g. "replace_with_username_v1". - // We also recommand providing a human-readable description as protobuf + // We also recommend providing a human-readable description as protobuf // comments on this annotation, for example a short specification or a link // to the relevant documentation. // diff --git a/proto/cosmos/staking/v1beta1/staking.proto b/proto/cosmos/staking/v1beta1/staking.proto index f7596c57d7f4..dc76b743f6ad 100644 --- a/proto/cosmos/staking/v1beta1/staking.proto +++ b/proto/cosmos/staking/v1beta1/staking.proto @@ -144,7 +144,7 @@ message Validator { // strictly positive if this validator's unbonding has been stopped by external modules int64 unbonding_on_hold_ref_count = 12; - // list of unbonding ids, each uniquely identifing an unbonding of this validator + // list of unbonding ids, each uniquely identifying an unbonding of this validator repeated uint64 unbonding_ids = 13; } @@ -420,7 +420,7 @@ message ConsPubKeyRotationHistory { google.protobuf.Any old_cons_pubkey = 2 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; // new_cons_pubkey is the new consensus public key of the validator, as a Protobuf Any. google.protobuf.Any new_cons_pubkey = 3 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; - // height defines the block height at which the rotation event occured. + // height defines the block height at which the rotation event occurred. uint64 height = 4; // fee holds the amount of fee deduced for the rotation. cosmos.base.v1beta1.Coin fee = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 78eeccebf468..bb5982801fdc 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -346,7 +346,7 @@ message ResponseVerifyVoteExtension { } message ResponseFinalizeBlock { - // set of block events emmitted as part of executing the block + // set of block events emitted as part of executing the block repeated Event events = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // the result of executing each transaction including the events // the particular transction emitted. This should match the order diff --git a/proto/tendermint/crypto/proof.proto b/proto/tendermint/crypto/proof.proto index ae72195e8684..7f22a0052e13 100644 --- a/proto/tendermint/crypto/proof.proto +++ b/proto/tendermint/crypto/proof.proto @@ -27,7 +27,7 @@ message DominoOp { } // ProofOp defines an operation used for calculating Merkle root -// The data could be arbitrary format, providing nessecary data +// The data could be arbitrary format, providing necessary data // for example neighbouring node hash message ProofOp { string type = 1; diff --git a/server/config/config.go b/server/config/config.go index bad21f6df3bb..f3e5b04913bf 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -69,7 +69,7 @@ type BaseConfig struct { // It has no bearing on application state pruning which is determined by the // "pruning-*" configurations. // - // Note: CometBFT block pruning is dependant on this parameter in conjunction + // Note: CometBFT block pruning is dependent on this parameter in conjunction // with the unbonding (safety threshold) period, state pruning and state sync // snapshot parameters to determine the correct minimum value of // ResponseCommit.RetainHeight. diff --git a/server/config/toml.go b/server/config/toml.go index e5bbf26f8877..f06ece5071f8 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -58,7 +58,7 @@ halt-time = {{ .BaseConfig.HaltTime }} # It has no bearing on application state pruning which is determined by the # "pruning-*" configurations. # -# Note: CometBFT block pruning is dependant on this parameter in conjunction +# Note: CometBFT block pruning is dependent on this parameter in conjunction # with the unbonding (safety threshold) period, state pruning and state sync # snapshot parameters to determine the correct minimum value of # ResponseCommit.RetainHeight. @@ -121,6 +121,17 @@ global-labels = [{{ range $k, $v := .Telemetry.GlobalLabels }} ["{{index $v 0 }}", "{{ index $v 1}}"],{{ end }} ] +# MetricsSink defines the type of metrics sink to use. +metrics-sink = "{{ .Telemetry.MetricsSink }}" + +# StatsdAddr defines the address of a statsd server to send metrics to. +# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". +statsd-addr = "{{ .Telemetry.StatsdAddr }}" + +# DatadogHostname defines the hostname to use when emitting metrics to +# Datadog. Only utilized if MetricsSink is set to "dogstatsd". +datadog-hostname = "{{ .Telemetry.DatadogHostname }}" + ############################################################################### ### API Configuration ### ############################################################################### diff --git a/server/grpc/reflection/v2alpha1/reflection.pb.go b/server/grpc/reflection/v2alpha1/reflection.pb.go index 360e4440e8f6..78954f020945 100644 --- a/server/grpc/reflection/v2alpha1/reflection.pb.go +++ b/server/grpc/reflection/v2alpha1/reflection.pb.go @@ -39,7 +39,7 @@ type AppDescriptor struct { Codec *CodecDescriptor `protobuf:"bytes,3,opt,name=codec,proto3" json:"codec,omitempty"` // configuration provides metadata information regarding the sdk.Config type Configuration *ConfigurationDescriptor `protobuf:"bytes,4,opt,name=configuration,proto3" json:"configuration,omitempty"` - // query_services provides metadata information regarding the available queriable endpoints + // query_services provides metadata information regarding the available queryable endpoints QueryServices *QueryServicesDescriptor `protobuf:"bytes,5,opt,name=query_services,json=queryServices,proto3" json:"query_services,omitempty"` // tx provides metadata information regarding how to send transactions to the given application Tx *TxDescriptor `protobuf:"bytes,6,opt,name=tx,proto3" json:"tx,omitempty"` @@ -1156,7 +1156,7 @@ func (m *GetTxDescriptorResponse) GetTx() *TxDescriptor { return nil } -// QueryServicesDescriptor contains the list of cosmos-sdk queriable services +// QueryServicesDescriptor contains the list of cosmos-sdk queryable services type QueryServicesDescriptor struct { // query_services is a list of cosmos-sdk QueryServiceDescriptor QueryServices []*QueryServiceDescriptor `protobuf:"bytes,1,rep,name=query_services,json=queryServices,proto3" json:"query_services,omitempty"` diff --git a/server/mock/store.go b/server/mock/store.go index 6e8a30364614..4dee9024b17f 100644 --- a/server/mock/store.go +++ b/server/mock/store.go @@ -217,7 +217,7 @@ func (kv kvStore) Prefix(prefix []byte) storetypes.KVStore { } func (kv kvStore) Gas(meter storetypes.GasMeter, config storetypes.GasConfig) storetypes.KVStore { - panic("not implmeneted") + panic("not implemented") } func (kv kvStore) Iterator(start, end []byte) storetypes.Iterator { diff --git a/simapp/app.go b/simapp/app.go index 5ab2391eb763..4bffaaa09a7a 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -287,9 +287,10 @@ func NewSimApp( runtime.EventService{}, runtime.BranchService{}, app.AuthKeeper.AddressCodec(), - appCodec.InterfaceRegistry().SigningContext(), + appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter(), + appCodec.InterfaceRegistry(), accountstd.AddAccount("counter", counter.NewAccount), accountstd.AddAccount("aa_minimal", account_abstraction.NewMinimalAbstractedAccount), accountstd.AddAccount("aa_full", account_abstraction.NewFullAbstractedAccount), diff --git a/simapp/app_config.go b/simapp/app_config.go index 74fce0c5d64c..4f19426b8198 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -184,7 +184,7 @@ var ( Name: stakingtypes.ModuleName, Config: appconfig.WrapAny(&stakingmodulev1.Module{ // NOTE: specifying a prefix is only necessary when using bech32 addresses - // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default + // If not specified, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default Bech32PrefixValidator: "cosmosvaloper", Bech32PrefixConsensus: "cosmosvalcons", }), diff --git a/simapp/go.mod b/simapp/go.mod index 87115fa449b0..cd9c0b05ac60 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -57,8 +57,11 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect @@ -145,10 +148,12 @@ require ( github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.8.6 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mdp/qrterminal/v3 v3.2.0 // indirect github.com/minio/highwayhash v1.0.2 // indirect @@ -156,9 +161,10 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/muesli/termenv v0.15.2 // indirect github.com/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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -167,6 +173,7 @@ require ( 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/rivo/uniseg v0.2.0 // 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 @@ -182,17 +189,21 @@ require ( 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 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // 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.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index 64c7f269820b..93c932ab06fc 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -213,6 +213,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -248,6 +250,8 @@ github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX github.com/aws/aws-sdk-go v1.45.25 h1:c4fLlh5sLdK2DCRTY1z0hyuJZU4ygxX8m1FswL6/nF4= github.com/aws/aws-sdk-go v1.45.25/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -750,6 +754,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.8.6 h1:O7I6SIGPrypf3f/gmrrLUBQDKfO8uOoYdWf4gLS06tc= github.com/linxGnu/grocksdb v1.8.6/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/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= @@ -771,6 +777,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE 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/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 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= @@ -801,6 +809,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G 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/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= +github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= 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= @@ -857,8 +867,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -913,6 +923,8 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c 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/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 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= @@ -1025,6 +1037,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index b4dded48b043..e52914489888 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -50,12 +50,21 @@ schema = 3 version = "v1.2.0" hash = "sha256-emQlH+RQpESoFCzpHS38fEhs1SLjotxNPlRK4B5Aybs=" replaced = "github.com/cosmos/keyring" + [mod."github.com/DataDog/datadog-go"] + version = "v4.8.3+incompatible" + hash = "sha256-9KvlVQdgyJ1ulDa6wkLb0ACdjc+R0U91hdb7nxodrA0=" [mod."github.com/DataDog/zstd"] version = "v1.5.5" hash = "sha256-tSw0aq0pPyroZtQYYb9lWOtPVNaQOt8skYQ4TMXGvAQ=" + [mod."github.com/Microsoft/go-winio"] + version = "v0.6.0" + hash = "sha256-TQ0AvXZfuT3PDnb4p/h5zmyT8m9VPcwxlXMJuVD6ltE=" [mod."github.com/aws/aws-sdk-go"] version = "v1.45.25" hash = "sha256-ZzeU4WSHm5shDqGnK2mXC2p18NyAO+hKZHP7l1KR69k=" + [mod."github.com/aymanbagabas/go-osc52/v2"] + version = "v2.0.1" + hash = "sha256-6Bp0jBZ6npvsYcKZGHHIUSVSTAMEyieweAX2YAKDjjg=" [mod."github.com/beorn7/perks"] version = "v1.0.1" hash = "sha256-h75GUqfwJKngCJQVE5Ao5wnO3cfKD9lSIteoLp/3xJ4=" @@ -326,6 +335,9 @@ schema = 3 [mod."github.com/linxGnu/grocksdb"] version = "v1.8.6" hash = "sha256-QOiVB6QU3AKNuuw1dbslszl+CwCF52f0hfb3YXDvLq8=" + [mod."github.com/lucasb-eyer/go-colorful"] + version = "v1.2.0" + hash = "sha256-Gg9dDJFCTaHrKHRR1SrJgZ8fWieJkybljybkI9x0gyE=" [mod."github.com/magiconair/properties"] version = "v1.8.7" hash = "sha256-XQ2bnc2s7/IH3WxEO4GishZurMyKwEclZy1DXg+2xXc=" @@ -338,6 +350,9 @@ schema = 3 [mod."github.com/mattn/go-isatty"] version = "v0.0.20" hash = "sha256-qhw9hWtU5wnyFyuMbKx+7RB8ckQaFQ8D+8GKPkN3HHQ=" + [mod."github.com/mattn/go-runewidth"] + version = "v0.0.14" + hash = "sha256-O3QdxqAcJgQ+HL1v8oBA4iKBwJ2AlDN+F464027hWMU=" [mod."github.com/matttproud/golang_protobuf_extensions/v2"] version = "v2.0.0" hash = "sha256-gcAN8jKL0ve8pcgDkxr2Lc8CUBG39ri9QAp0zrzchEs=" @@ -359,6 +374,9 @@ schema = 3 [mod."github.com/mtibben/percent"] version = "v0.2.1" hash = "sha256-Zj1lpCP6mKQ0UUTMs2By4LC414ou+iJzKkK+eBHfEcc=" + [mod."github.com/muesli/termenv"] + version = "v0.15.2" + hash = "sha256-Eum/SpyytcNIchANPkG4bYGBgcezLgej7j/+6IhqoMU=" [mod."github.com/oasisprotocol/curve25519-voi"] version = "v0.0.0-20230904125328-1f23a7beb09a" hash = "sha256-N5MMNn4rytO3ObXVXoY34Sf7AGPkw2dTPkXjigjozls=" @@ -366,8 +384,8 @@ schema = 3 version = "v1.1.0" hash = "sha256-U4IS0keJa4BSBSeEBqtIV1Zg6N4b0zFiKfzN9ua4pWQ=" [mod."github.com/pelletier/go-toml/v2"] - version = "v2.1.0" - hash = "sha256-0u6oV8YMM26y2bw1oe3gLmEJc/whpNaFtEe4yOkN24c=" + version = "v2.1.1" + hash = "sha256-BQtflYQ8Dt7FL/yFI9OnxwvsRk0oEO37ZXuGXFveVpo=" [mod."github.com/petermattis/goid"] version = "v0.0.0-20231126143041-f558c26febf5" hash = "sha256-59jZe0vsHp1vgj+o4D6IPgoyw9C2+jVxmh7uwfxUSzU=" @@ -392,6 +410,9 @@ schema = 3 [mod."github.com/rcrowley/go-metrics"] version = "v0.0.0-20201227073835-cf1acfcdf475" hash = "sha256-10ytHQ1SpMKYTiKuOPdEMuOVa8HVvv9ryYSIF9BHEBI=" + [mod."github.com/rivo/uniseg"] + version = "v0.2.0" + hash = "sha256-GLj0jiGrT03Ept4V6FXCN1yeZ/b6PpS3MEXK6rYQ8Eg=" [mod."github.com/rogpeppe/go-internal"] version = "v1.11.0" hash = "sha256-BucSndJVnqX9e6p5PfA6Z8N2bGfIeRfxAxYLUDXTbIo=" @@ -453,6 +474,12 @@ schema = 3 [mod."github.com/zondax/ledger-go"] version = "v0.14.3" hash = "sha256-tldEok5ebZ4R4B7H8dSlYS5oVuLvh89n9wUaVlDjYwg=" + [mod."gitlab.com/yawning/secp256k1-voi"] + version = "v0.0.0-20230925100816-f2616030848b" + hash = "sha256-X8INg01LTg13iOuwPI3uOhPN7r01sPZtmtwJ2sudjCA=" + [mod."gitlab.com/yawning/tuplehash"] + version = "v0.0.0-20230713102510-df83abbf9a02" + hash = "sha256-pehQduoaJRLchebhgvMYacVvbuNIBA++XkiqCuqdato=" [mod."go.etcd.io/bbolt"] version = "v1.3.7" hash = "sha256-poZk8tPLDWwW95oCOkTJcQtEvOJTD9UXAZ2TqGJutwk=" @@ -468,6 +495,9 @@ schema = 3 [mod."golang.org/x/exp"] version = "v0.0.0-20231127185646-65229373498e" hash = "sha256-GmQxMsgz6rZ/O7d4uFif6A/BpDfCqM7WpciDggDSv8I=" + [mod."golang.org/x/mod"] + version = "v0.14.0" + hash = "sha256-sx3hWp5l99DBfIrn821ohfoBwvaITSHMWbzPvX0btLM=" [mod."golang.org/x/net"] version = "v0.19.0" hash = "sha256-3M5rKEvJx4cO/q+06cGjR5sxF5JpnUWY0+fQttrWdT4=" @@ -486,6 +516,9 @@ schema = 3 [mod."golang.org/x/text"] version = "v0.14.0" hash = "sha256-yh3B0tom1RfzQBf1RNmfdNWF1PtiqxV41jW1GVS6JAg=" + [mod."golang.org/x/tools"] + version = "v0.16.0" + hash = "sha256-uVAW8zkeyMvPaWjXjyvq+DCfuA348YtwCrXzNROs7EQ=" [mod."golang.org/x/xerrors"] version = "v0.0.0-20231012003039-104605ab7028" hash = "sha256-IsFTm5WZQ6W1ZDF8WOP+6xiOAc7pIq8r9Afvkjp3PRQ=" diff --git a/simapp/simd/cmd/config.go b/simapp/simd/cmd/config.go index c4539aea3355..cda73a922dd1 100644 --- a/simapp/simd/cmd/config.go +++ b/simapp/simd/cmd/config.go @@ -61,7 +61,7 @@ func initClientConfig() (string, interface{}) { // And we set the default config to the custom app template. customClientConfigTemplate := clientconfig.DefaultClientConfigTemplate + strings.TrimSpace(` # This is default the gas adjustment factor used in tx commands. -# It can be overwriten by the --gas-adjustment flag in each tx command. +# It can be overwritten by the --gas-adjustment flag in each tx command. gas-adjustment = {{ .GasConfig.GasAdjustment }} `) diff --git a/store/CHANGELOG.md b/store/CHANGELOG.md index a7f32502c7ce..819a735ac08e 100644 --- a/store/CHANGELOG.md +++ b/store/CHANGELOG.md @@ -33,6 +33,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#17158](https://github.com/cosmos/cosmos-sdk/pull/17158) Start the goroutine after need to create a snapshot. +### Bug fixes + +* [#18651](https://github.com/cosmos/cosmos-sdk/pull/18651) Propagate iavl.MutableTree.Remove errors firstly to the caller instead of returning a synthesized error firstly. + ## [v1.0.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store%2Fv1.0.0-alpha.1) - 2023-07-11 @@ -54,7 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes -* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propogate the Snapshotter's failure to the caller, (it will create a empty snapshot silently before). +* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propagate the Snapshotter's failure to the caller, (it will create a empty snapshot silently before). ## [v0.1.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store%2Fv0.1.0-alpha.1) - 2023-03-17 diff --git a/store/changeset.go b/store/changeset.go index b9ceaa50764f..6982344375af 100644 --- a/store/changeset.go +++ b/store/changeset.go @@ -4,8 +4,9 @@ package store // track writes. Deletion can be denoted by a nil value or explicitly by the // Delete field. type KVPair struct { - Key []byte - Value []byte + Key []byte + Value []byte + StoreKey string // Optional for snapshot restore } type KVPairs []KVPair diff --git a/store/commit_info.go b/store/commit_info.go index 103118ece02f..1bfad27e3eef 100644 --- a/store/commit_info.go +++ b/store/commit_info.go @@ -8,14 +8,6 @@ import ( ) type ( - // CommitHeader defines the interface for a block header that can be provided - // to a MultiStore upon Commit. This should be optional and used to facilitate - // time-based queries only. - CommitHeader interface { - GetTime() time.Time - GetHeight() uint64 - } - // CommitInfo defines commit information used by the multi-store when committing // a version/height. CommitInfo struct { @@ -80,3 +72,7 @@ func (m *CommitInfo) GetVersion() uint64 { func (cid CommitID) String() string { return fmt.Sprintf("CommitID{%v:%X}", cid.Hash, cid.Version) } + +func (cid CommitID) IsZero() bool { + return cid.Version == 0 && len(cid.Hash) == 0 +} diff --git a/store/commitment/iavl/exporter.go b/store/commitment/iavl/exporter.go new file mode 100644 index 000000000000..20f00d1a1722 --- /dev/null +++ b/store/commitment/iavl/exporter.go @@ -0,0 +1,40 @@ +package iavl + +import ( + "errors" + + "github.com/cosmos/iavl" + + "cosmossdk.io/store/v2/commitment" + snapshotstypes "cosmossdk.io/store/v2/snapshots/types" +) + +// Exporter is a wrapper around iavl.Exporter. +type Exporter struct { + exporter *iavl.Exporter +} + +// Next returns the next item in the exporter. +func (e *Exporter) Next() (*snapshotstypes.SnapshotIAVLItem, error) { + item, err := e.exporter.Next() + if err != nil { + if errors.Is(err, iavl.ErrorExportDone) { + return nil, commitment.ErrorExportDone + } + return nil, err + } + + return &snapshotstypes.SnapshotIAVLItem{ + Key: item.Key, + Value: item.Value, + Version: item.Version, + Height: int32(item.Height), + }, nil +} + +// Close closes the exporter. +func (e *Exporter) Close() error { + e.exporter.Close() + + return nil +} diff --git a/store/commitment/iavl/importer.go b/store/commitment/iavl/importer.go new file mode 100644 index 000000000000..6f1b0eedf21f --- /dev/null +++ b/store/commitment/iavl/importer.go @@ -0,0 +1,34 @@ +package iavl + +import ( + "github.com/cosmos/iavl" + + snapshotstypes "cosmossdk.io/store/v2/snapshots/types" +) + +// Importer is a wrapper around iavl.Importer. +type Importer struct { + importer *iavl.Importer +} + +// Add adds the given item to the importer. +func (i *Importer) Add(item *snapshotstypes.SnapshotIAVLItem) error { + return i.importer.Add(&iavl.ExportNode{ + Key: item.Key, + Value: item.Value, + Version: item.Version, + Height: int8(item.Height), + }) +} + +// Commit commits the importer. +func (i *Importer) Commit() error { + return i.importer.Commit() +} + +// Close closes the importer. +func (i *Importer) Close() error { + i.importer.Close() + + return nil +} diff --git a/store/commitment/iavl/tree.go b/store/commitment/iavl/tree.go index 5388769dba74..dc559152c171 100644 --- a/store/commitment/iavl/tree.go +++ b/store/commitment/iavl/tree.go @@ -29,10 +29,13 @@ func NewIavlTree(db dbm.DB, logger log.Logger, cfg *Config) *IavlTree { // Remove removes the given key from the tree. func (t *IavlTree) Remove(key []byte) error { _, res, err := t.tree.Remove(key) + if err != nil { + return err + } if !res { return fmt.Errorf("key %x not found", key) } - return err + return nil } // Set sets the given key-value pair in the tree. @@ -72,11 +75,45 @@ func (t *IavlTree) GetLatestVersion() uint64 { return uint64(t.tree.Version()) } +// SetInitialVersion sets the initial version of the database. +func (t *IavlTree) SetInitialVersion(version uint64) error { + t.tree.SetInitialVersion(version) + return nil +} + // Prune prunes all versions up to and including the provided version. func (t *IavlTree) Prune(version uint64) error { return t.tree.DeleteVersionsTo(int64(version)) } +// Export exports the tree exporter at the given version. +func (t *IavlTree) Export(version uint64) (commitment.Exporter, error) { + tree, err := t.tree.GetImmutable(int64(version)) + if err != nil { + return nil, err + } + exporter, err := tree.Export() + if err != nil { + return nil, err + } + + return &Exporter{ + exporter: exporter, + }, nil +} + +// Import imports the tree importer at the given version. +func (t *IavlTree) Import(version uint64) (commitment.Importer, error) { + importer, err := t.tree.Import(int64(version)) + if err != nil { + return nil, err + } + + return &Importer{ + importer: importer, + }, nil +} + // Close closes the iavl tree. func (t *IavlTree) Close() error { return nil diff --git a/store/commitment/iavl/tree_test.go b/store/commitment/iavl/tree_test.go index 9b73c0b7b560..a1ea79bcc7c8 100644 --- a/store/commitment/iavl/tree_test.go +++ b/store/commitment/iavl/tree_test.go @@ -5,11 +5,29 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" "cosmossdk.io/log" + "cosmossdk.io/store/v2/commitment" ) -func generateTree(treeType string) *IavlTree { +func TestCommitterSuite(t *testing.T) { + s := &commitment.CommitStoreTestSuite{ + NewStore: func(db dbm.DB, storeKeys []string, logger log.Logger) (*commitment.CommitStore, error) { + multiTrees := make(map[string]commitment.Tree) + cfg := DefaultConfig() + for _, storeKey := range storeKeys { + prefixDB := dbm.NewPrefixDB(db, []byte(storeKey)) + multiTrees[storeKey] = NewIavlTree(prefixDB, logger, cfg) + } + return commitment.NewCommitStore(multiTrees, logger) + }, + } + + suite.Run(t, s) +} + +func generateTree() *IavlTree { cfg := DefaultConfig() db := dbm.NewMemDB() return NewIavlTree(db, log.NewNopLogger(), cfg) @@ -17,7 +35,7 @@ func generateTree(treeType string) *IavlTree { func TestIavlTree(t *testing.T) { // generate a new tree - tree := generateTree("iavl") + tree := generateTree() require.NotNil(t, tree) initVersion := tree.GetLatestVersion() diff --git a/store/commitment/store.go b/store/commitment/store.go index 32952ef58f89..1a716ac15f43 100644 --- a/store/commitment/store.go +++ b/store/commitment/store.go @@ -3,14 +3,22 @@ package commitment import ( "errors" "fmt" + "io" + "math" + protoio "github.com/cosmos/gogoproto/io" ics23 "github.com/cosmos/ics23/go" "cosmossdk.io/log" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/snapshots" + snapshotstypes "cosmossdk.io/store/v2/snapshots/types" ) -var _ store.Committer = (*CommitStore)(nil) +var ( + _ store.Committer = (*CommitStore)(nil) + _ snapshots.CommitSnapshotter = (*CommitStore)(nil) +) // CommitStore is a wrapper around multiple Tree objects mapped by a unique store // key. Each store key reflects dedicated and unique usage within a module. A caller @@ -108,6 +116,16 @@ func (c *CommitStore) Commit() ([]store.StoreInfo, error) { return storeInfos, nil } +func (c *CommitStore) SetInitialVersion(version uint64) error { + for _, tree := range c.multiTrees { + if err := tree.SetInitialVersion(version); err != nil { + return err + } + } + + return nil +} + func (c *CommitStore) GetProof(storeKey string, version uint64, key []byte) (*ics23.CommitmentProof, error) { tree, ok := c.multiTrees[storeKey] if !ok { @@ -127,6 +145,146 @@ func (c *CommitStore) Prune(version uint64) (ferr error) { return ferr } +// Snapshot implements snapshotstypes.CommitSnapshotter. +func (c *CommitStore) Snapshot(version uint64, protoWriter protoio.Writer) error { + if version == 0 { + return fmt.Errorf("the snapshot version must be greater than 0") + } + + latestVersion, err := c.GetLatestVersion() + if err != nil { + return err + } + if version > latestVersion { + return fmt.Errorf("the snapshot version %d is greater than the latest version %d", version, latestVersion) + } + + for storeKey, tree := range c.multiTrees { + // TODO: check the parallelism of this loop + if err := func() error { + exporter, err := tree.Export(version) + if err != nil { + return fmt.Errorf("failed to export tree for version %d: %w", version, err) + } + defer exporter.Close() + + err = protoWriter.WriteMsg(&snapshotstypes.SnapshotItem{ + Item: &snapshotstypes.SnapshotItem_Store{ + Store: &snapshotstypes.SnapshotStoreItem{ + Name: storeKey, + }, + }, + }) + if err != nil { + return fmt.Errorf("failed to write store name: %w", err) + } + + for { + item, err := exporter.Next() + if errors.Is(err, ErrorExportDone) { + break + } else if err != nil { + return fmt.Errorf("failed to get the next export node: %w", err) + } + + if err = protoWriter.WriteMsg(&snapshotstypes.SnapshotItem{ + Item: &snapshotstypes.SnapshotItem_IAVL{ + IAVL: item, + }, + }); err != nil { + return fmt.Errorf("failed to write iavl node: %w", err) + } + } + + return nil + }(); err != nil { + return err + } + } + + return nil +} + +// Restore implements snapshotstypes.CommitSnapshotter. +func (c *CommitStore) Restore(version uint64, format uint32, protoReader protoio.Reader, chStorage chan<- *store.KVPair) (snapshotstypes.SnapshotItem, error) { + var ( + importer Importer + snapshotItem snapshotstypes.SnapshotItem + storeKey string + ) + +loop: + for { + snapshotItem = snapshotstypes.SnapshotItem{} + err := protoReader.ReadMsg(&snapshotItem) + if errors.Is(err, io.EOF) { + break + } else if err != nil { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("invalid protobuf message: %w", err) + } + + switch item := snapshotItem.Item.(type) { + case *snapshotstypes.SnapshotItem_Store: + if importer != nil { + if err := importer.Commit(); err != nil { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("failed to commit importer: %w", err) + } + importer.Close() + } + storeKey = item.Store.Name + tree := c.multiTrees[storeKey] + if tree == nil { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("store %s not found", storeKey) + } + importer, err = tree.Import(version) + if err != nil { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("failed to import tree for version %d: %w", version, err) + } + defer importer.Close() + + case *snapshotstypes.SnapshotItem_IAVL: + if importer == nil { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("received IAVL node item before store item") + } + node := item.IAVL + if node.Height > int32(math.MaxInt8) { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("node height %v cannot exceed %v", + item.IAVL.Height, math.MaxInt8) + } + // Protobuf does not differentiate between []byte{} and nil, but fortunately IAVL does + // not allow nil keys nor nil values for leaf nodes, so we can always set them to empty. + if node.Key == nil { + node.Key = []byte{} + } + if node.Height == 0 { + if node.Value == nil { + node.Value = []byte{} + } + // If the node is a leaf node, it will be written to the storage. + chStorage <- &store.KVPair{ + Key: node.Key, + Value: node.Value, + StoreKey: storeKey, + } + } + err := importer.Add(node) + if err != nil { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("failed to add node to importer: %w", err) + } + default: + break loop + } + } + + if importer != nil { + if err := importer.Commit(); err != nil { + return snapshotstypes.SnapshotItem{}, fmt.Errorf("failed to commit importer: %w", err) + } + } + + return snapshotItem, c.LoadVersion(version) +} + func (c *CommitStore) Close() (ferr error) { for _, tree := range c.multiTrees { if err := tree.Close(); err != nil { diff --git a/store/commitment/store_test_suite.go b/store/commitment/store_test_suite.go new file mode 100644 index 000000000000..370958cb3f10 --- /dev/null +++ b/store/commitment/store_test_suite.go @@ -0,0 +1,121 @@ +package commitment + +import ( + "fmt" + "io" + "sync" + + dbm "github.com/cosmos/cosmos-db" + "github.com/stretchr/testify/suite" + + "cosmossdk.io/log" + "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/snapshots" + snapshotstypes "cosmossdk.io/store/v2/snapshots/types" +) + +const ( + storeKey1 = "store1" + storeKey2 = "store2" +) + +// CommitStoreTestSuite is a test suite to be used for all tree backends. +type CommitStoreTestSuite struct { + suite.Suite + + NewStore func(db dbm.DB, storeKeys []string, logger log.Logger) (*CommitStore, error) +} + +func (s *CommitStoreTestSuite) TestSnapshotter() { + storeKeys := []string{storeKey1, storeKey2} + commitStore, err := s.NewStore(dbm.NewMemDB(), storeKeys, log.NewNopLogger()) + s.Require().NoError(err) + + latestVersion := uint64(10) + kvCount := 10 + for i := uint64(1); i <= latestVersion; i++ { + kvPairs := make(map[string]store.KVPairs) + for _, storeKey := range storeKeys { + kvPairs[storeKey] = store.KVPairs{} + for j := 0; j < kvCount; j++ { + key := []byte(fmt.Sprintf("key-%d-%d", i, j)) + value := []byte(fmt.Sprintf("value-%d-%d", i, j)) + kvPairs[storeKey] = append(kvPairs[storeKey], store.KVPair{Key: key, Value: value}) + } + } + s.Require().NoError(commitStore.WriteBatch(store.NewChangeset(kvPairs))) + + _, err = commitStore.Commit() + s.Require().NoError(err) + } + + latestStoreInfos := commitStore.WorkingStoreInfos(latestVersion) + s.Require().Equal(len(storeKeys), len(latestStoreInfos)) + + // create a snapshot + dummyExtensionItem := snapshotstypes.SnapshotItem{ + Item: &snapshotstypes.SnapshotItem_Extension{ + Extension: &snapshotstypes.SnapshotExtensionMeta{ + Name: "test", + Format: 1, + }, + }, + } + + targetStore, err := s.NewStore(dbm.NewMemDB(), storeKeys, log.NewNopLogger()) + s.Require().NoError(err) + + chunks := make(chan io.ReadCloser, kvCount*int(latestVersion)) + go func() { + streamWriter := snapshots.NewStreamWriter(chunks) + s.Require().NotNil(streamWriter) + defer streamWriter.Close() + err := commitStore.Snapshot(latestVersion, streamWriter) + s.Require().NoError(err) + // write an extension metadata + err = streamWriter.WriteMsg(&dummyExtensionItem) + s.Require().NoError(err) + }() + + streamReader, err := snapshots.NewStreamReader(chunks) + s.Require().NoError(err) + chStorage := make(chan *store.KVPair, 100) + leaves := make(map[string]string) + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + for kv := range chStorage { + leaves[fmt.Sprintf("%s_%s", kv.StoreKey, kv.Key)] = string(kv.Value) + } + wg.Done() + }() + nextItem, err := targetStore.Restore(latestVersion, snapshotstypes.CurrentFormat, streamReader, chStorage) + s.Require().NoError(err) + s.Require().Equal(*dummyExtensionItem.GetExtension(), *nextItem.GetExtension()) + + close(chStorage) + wg.Wait() + s.Require().Equal(len(storeKeys)*kvCount*int(latestVersion), len(leaves)) + for _, storeKey := range storeKeys { + for i := 1; i <= int(latestVersion); i++ { + for j := 0; j < kvCount; j++ { + key := fmt.Sprintf("%s_key-%d-%d", storeKey, i, j) + s.Require().Equal(leaves[key], fmt.Sprintf("value-%d-%d", i, j)) + } + } + } + + // check the restored tree hash + targetStoreInfos := targetStore.WorkingStoreInfos(latestVersion) + s.Require().Equal(len(storeKeys), len(targetStoreInfos)) + for _, storeInfo := range targetStoreInfos { + matched := false + for _, latestStoreInfo := range latestStoreInfos { + if storeInfo.Name == latestStoreInfo.Name { + s.Require().Equal(latestStoreInfo.GetHash(), storeInfo.GetHash()) + matched = true + } + } + s.Require().True(matched) + } +} diff --git a/store/commitment/tree.go b/store/commitment/tree.go index b55c90c5fad1..7e41e03e5baa 100644 --- a/store/commitment/tree.go +++ b/store/commitment/tree.go @@ -1,11 +1,17 @@ package commitment import ( + "errors" "io" ics23 "github.com/cosmos/ics23/go" + + snapshotstypes "cosmossdk.io/store/v2/snapshots/types" ) +// ErrorExportDone is returned by Exporter.Next() when all items have been exported. +var ErrorExportDone = errors.New("export is complete") + // Tree is the interface that wraps the basic Tree methods. type Tree interface { Set(key, value []byte) error @@ -14,8 +20,26 @@ type Tree interface { WorkingHash() []byte LoadVersion(version uint64) error Commit() ([]byte, error) + SetInitialVersion(version uint64) error GetProof(version uint64, key []byte) (*ics23.CommitmentProof, error) Prune(version uint64) error + Export(version uint64) (Exporter, error) + Import(version uint64) (Importer, error) + + io.Closer +} + +// Exporter is the interface that wraps the basic Export methods. +type Exporter interface { + Next() (*snapshotstypes.SnapshotIAVLItem, error) + + io.Closer +} + +// Importer is the interface that wraps the basic Import methods. +type Importer interface { + Add(*snapshotstypes.SnapshotIAVLItem) error + Commit() error io.Closer } diff --git a/store/database.go b/store/database.go index 498e815a8a6d..992dd3db4684 100644 --- a/store/database.go +++ b/store/database.go @@ -72,6 +72,7 @@ type Committer interface { GetLatestVersion() (uint64, error) LoadVersion(targetVersion uint64) error Commit() ([]StoreInfo, error) + SetInitialVersion(version uint64) error GetProof(storeKey string, version uint64, key []byte) (*ics23.CommitmentProof, error) // Prune attempts to prune all versions up to and including the provided diff --git a/store/gas.go b/store/gas.go index f7743486f09d..9bd142e506fa 100644 --- a/store/gas.go +++ b/store/gas.go @@ -9,7 +9,7 @@ import ( // SDK for store operations such as Get and Set calls. In addition, callers have // the ability to explicitly charge gas for costly operations such as signature // verification. -type Gas uint64 +type Gas = uint64 // Gas consumption descriptors. const ( diff --git a/store/go.mod b/store/go.mod index f27699b9fe14..b37ef6761c07 100644 --- a/store/go.mod +++ b/store/go.mod @@ -3,6 +3,7 @@ module cosmossdk.io/store/v2 go 1.21 require ( + cosmossdk.io/core v0.12.0 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 cosmossdk.io/math v1.2.0 @@ -58,13 +59,13 @@ require ( github.com/rs/zerolog v1.31.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect golang.org/x/crypto v0.16.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/store/go.sum b/store/go.sum index 30e8b47236dc..b44acba0807d 100644 --- a/store/go.sum +++ b/store/go.sum @@ -1,3 +1,5 @@ +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= 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= @@ -24,6 +26,9 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= 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/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= @@ -63,6 +68,7 @@ github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0X 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.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= 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= @@ -74,6 +80,7 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 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-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -90,6 +97,7 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -103,6 +111,7 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ 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 v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -114,6 +123,7 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -148,16 +158,21 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ 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/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae h1:FatpGJD2jmJfhZiFDElaC0QhZUDQnxUeAwTGkfAHN3I= github.com/oasisprotocol/curve25519-voi v0.0.0-20220708102147-0a8a51822cae/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= 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.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -209,10 +224,12 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ 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.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= 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/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/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= 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/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= @@ -235,10 +252,12 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/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-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= 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= @@ -256,31 +275,42 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/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-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/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-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/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-20220412211240-33da011f77ad/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-20220811171246-fbc7d0a398ab/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.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/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.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.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= 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/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -306,6 +336,7 @@ gopkg.in/yaml.v2 v2.2.2/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.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 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= diff --git a/store/kv/branch/store_test.go b/store/kv/branch/store_test.go index 4353f280f65f..424e396e0b2e 100644 --- a/store/kv/branch/store_test.go +++ b/store/kv/branch/store_test.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/kv/branch" + "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/sqlite" ) @@ -25,7 +26,8 @@ func TestStorageTestSuite(t *testing.T) { } func (s *StoreTestSuite) SetupTest() { - storage, err := sqlite.New(s.T().TempDir()) + sqliteDB, err := sqlite.New(s.T().TempDir()) + ss := storage.NewStorageStore(sqliteDB) s.Require().NoError(err) cs := store.NewChangeset(map[string]store.KVPairs{storeKey: {}}) @@ -36,12 +38,12 @@ func (s *StoreTestSuite) SetupTest() { cs.AddKVPair(storeKey, store.KVPair{Key: []byte(key), Value: []byte(val)}) } - s.Require().NoError(storage.ApplyChangeset(1, cs)) + s.Require().NoError(ss.ApplyChangeset(1, cs)) - kvStore, err := branch.New(storeKey, storage) + kvStore, err := branch.New(storeKey, ss) s.Require().NoError(err) - s.storage = storage + s.storage = ss s.kvStore = kvStore } diff --git a/store/proof.go b/store/proof.go new file mode 100644 index 000000000000..16a959ac9075 --- /dev/null +++ b/store/proof.go @@ -0,0 +1,98 @@ +package store + +import ( + ics23 "github.com/cosmos/ics23/go" + + errorsmod "cosmossdk.io/errors" +) + +// Proof operation types +const ( + ProofOpIAVLCommitment = "ics23:iavl" + ProofOpSimpleMerkleCommitment = "ics23:simple" + ProofOpSMTCommitment = "ics23:smt" +) + +// CommitmentOp implements merkle.ProofOperator by wrapping an ics23 CommitmentProof. +// It also contains a Key field to determine which key the proof is proving. +// NOTE: CommitmentProof currently can either be ExistenceProof or NonexistenceProof +// +// Type and Spec are classified by the kind of merkle proof it represents allowing +// the code to be reused by more types. Spec is never on the wire, but mapped +// from type in the code. +type CommitmentOp struct { + Type string + Key []byte + Spec *ics23.ProofSpec + Proof *ics23.CommitmentProof +} + +func NewIAVLCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp { + return CommitmentOp{ + Type: ProofOpIAVLCommitment, + Spec: ics23.IavlSpec, + Key: key, + Proof: proof, + } +} + +func NewSimpleMerkleCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp { + return CommitmentOp{ + Type: ProofOpSimpleMerkleCommitment, + Spec: ics23.TendermintSpec, + Key: key, + Proof: proof, + } +} + +func NewSMTCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp { + return CommitmentOp{ + Type: ProofOpSMTCommitment, + Spec: ics23.SmtSpec, + Key: key, + Proof: proof, + } +} + +func (op CommitmentOp) GetKey() []byte { + return op.Key +} + +// Run takes in a list of arguments and attempts to run the proof op against these +// arguments. Returns the root wrapped in [][]byte if the proof op succeeds with +// given args. If not, it will return an error. +// +// CommitmentOp will accept args of length 1 or length 0. If length 1 args is +// passed in, then CommitmentOp will attempt to prove the existence of the key +// with the value provided by args[0] using the embedded CommitmentProof and returns +// the CommitmentRoot of the proof. If length 0 args is passed in, then CommitmentOp +// will attempt to prove the absence of the key in the CommitmentOp and return the +// CommitmentRoot of the proof. +func (op CommitmentOp) Run(args [][]byte) ([][]byte, error) { + // calculate root from proof + root, err := op.Proof.Calculate() + if err != nil { + return nil, errorsmod.Wrapf(ErrInvalidProof, "could not calculate root for proof: %v", err) + } + + // Only support an existence proof or nonexistence proof (batch proofs currently unsupported) + switch len(args) { + case 0: + // Args are nil, so we verify the absence of the key. + absent := ics23.VerifyNonMembership(op.Spec, root, op.Proof, op.Key) + if !absent { + return nil, errorsmod.Wrapf(ErrInvalidProof, "proof did not verify absence of key: %s", string(op.Key)) + } + + case 1: + // Args is length 1, verify existence of key with value args[0] + if !ics23.VerifyMembership(op.Spec, root, op.Proof, op.Key, args[0]) { + return nil, errorsmod.Wrapf(ErrInvalidProof, "proof did not verify existence of key %s with given value %x", op.Key, args[0]) + } + + default: + return nil, errorsmod.Wrapf(ErrInvalidProof, "args must be length 0 or 1, got: %d", len(args)) + } + + return [][]byte{root}, nil +} diff --git a/store/pruning/manager.go b/store/pruning/manager.go index 3440af2ea1c1..313216e4f9d6 100644 --- a/store/pruning/manager.go +++ b/store/pruning/manager.go @@ -40,11 +40,17 @@ func NewManager( // SetStorageOptions sets the state storage options. func (m *Manager) SetStorageOptions(opts Options) { + m.mtx.Lock() + defer m.mtx.Unlock() + m.storageOpts = opts } // SetCommitmentOptions sets the state commitment options. func (m *Manager) SetCommitmentOptions(opts Options) { + m.mtx.Lock() + defer m.mtx.Unlock() + m.commitmentOpts = opts } @@ -113,6 +119,7 @@ func (m *Manager) Prune(height uint64) { m.chStorage <- struct{}{} }() } + default: m.logger.Debug("storage pruning is still running; skipping", "version", pruneHeight) } @@ -134,7 +141,9 @@ func (m *Manager) Prune(height uint64) { m.chCommitment <- struct{}{} }() } + default: + m.logger.Debug("commitment pruning is still running; skipping", "version", pruneHeight) } } } diff --git a/store/pruning/manager_test.go b/store/pruning/manager_test.go index 47cfd3025438..65e7fe1b09ec 100644 --- a/store/pruning/manager_test.go +++ b/store/pruning/manager_test.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/commitment" "cosmossdk.io/store/v2/commitment/iavl" + "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/sqlite" ) @@ -34,8 +35,9 @@ func (s *PruningTestSuite) SetupTest() { logger = log.NewTestLogger(s.T()) } - ss, err := sqlite.New(s.T().TempDir()) + sqliteDB, err := sqlite.New(s.T().TempDir()) s.Require().NoError(err) + ss := storage.NewStorageStore(sqliteDB) tree := iavl.NewIavlTree(dbm.NewMemDB(), log.NewNopLogger(), iavl.DefaultConfig()) sc, err := commitment.NewCommitStore(map[string]commitment.Tree{"default": tree}, logger) @@ -58,7 +60,7 @@ func (s *PruningTestSuite) TestPruning() { latestVersion := uint64(100) - // write 10 batches + // write batches for i := uint64(0); i < latestVersion; i++ { version := i + 1 diff --git a/store/root/store.go b/store/root/store.go index 4ff0cbe5c060..17397af684fd 100644 --- a/store/root/store.go +++ b/store/root/store.go @@ -9,6 +9,7 @@ import ( "github.com/cockroachdb/errors" + coreheader "cosmossdk.io/core/header" "cosmossdk.io/log" "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/kv/branch" @@ -43,7 +44,7 @@ type Store struct { rootKVStore store.BranchedKVStore // commitHeader reflects the header used when committing state (note, this isn't required and only used for query purposes) - commitHeader store.CommitHeader + commitHeader *coreheader.Info // lastCommitInfo reflects the last version/hash that has been committed lastCommitInfo *store.CommitInfo @@ -66,9 +67,9 @@ type Store struct { func New( logger log.Logger, - initVersion uint64, ss store.VersionedDatabase, sc store.Committer, + ssOpts, scOpts pruning.Options, m metrics.StoreMetrics, ) (store.RootStore, error) { rootKVStore, err := branch.New(defaultStoreKey, ss) @@ -77,10 +78,13 @@ func New( } pruningManager := pruning.NewManager(logger, ss, sc) + pruningManager.SetStorageOptions(ssOpts) + pruningManager.SetCommitmentOptions(scOpts) + pruningManager.Start() return &Store{ logger: logger.With("module", "root_store"), - initialVersion: initVersion, + initialVersion: 1, stateStore: ss, stateCommitment: sc, rootKVStore: rootKVStore, @@ -105,23 +109,18 @@ func (s *Store) Close() (err error) { return err } -// SetPruningOptions sets the pruning options on the SS and SC backends. -// NOTE: It will also start the pruning manager. -func (s *Store) SetPruningOptions(ssOpts, scOpts pruning.Options) { - s.pruningManager.SetStorageOptions(ssOpts) - s.pruningManager.SetCommitmentOptions(scOpts) - - s.pruningManager.Start() +func (s *Store) SetMetrics(m metrics.Metrics) { + s.telemetry = m } -// MountSCStore performs a no-op as a SC backend must be provided at initialization. -func (s *Store) MountSCStore(_ string, _ store.Committer) error { - return errors.New("cannot mount SC store; SC must be provided on initialization") +func (s *Store) SetInitialVersion(v uint64) error { + s.initialVersion = v + + return s.stateCommitment.SetInitialVersion(v) } -// GetSCStore returns the store's state commitment (SC) backend. Note, the store -// key is ignored as there exists only a single SC tree. -func (s *Store) GetSCStore(_ string) store.Committer { +// GetSCStore returns the store's state commitment (SC) backend. +func (s *Store) GetSCStore() store.Committer { return s.stateCommitment } @@ -191,7 +190,7 @@ func (s *Store) Query(storeKey string, version uint64, key []byte, prove bool) ( return store.QueryResult{}, err } - result.Proof = proof + result.Proof = store.NewIAVLCommitmentOp(key, proof) } return result, nil @@ -274,7 +273,7 @@ func (s *Store) TracingEnabled() bool { return s.traceWriter != nil } -func (s *Store) SetCommitHeader(h store.CommitHeader) { +func (s *Store) SetCommitHeader(h *coreheader.Info) { s.commitHeader = h } @@ -344,8 +343,8 @@ func (s *Store) Commit() ([]byte, error) { version := s.lastCommitInfo.Version - if s.commitHeader != nil && s.commitHeader.GetHeight() != version { - s.logger.Debug("commit header and version mismatch", "header_height", s.commitHeader.GetHeight(), "version", version) + if s.commitHeader != nil && uint64(s.commitHeader.Height) != version { + s.logger.Debug("commit header and version mismatch", "header_height", s.commitHeader.Height, "version", version) } changeset := s.rootKVStore.GetChangeset() @@ -361,7 +360,7 @@ func (s *Store) Commit() ([]byte, error) { } if s.commitHeader != nil { - s.lastCommitInfo.Timestamp = s.commitHeader.GetTime() + s.lastCommitInfo.Timestamp = s.commitHeader.Time } if err := s.rootKVStore.Reset(version); err != nil { diff --git a/store/root/store_test.go b/store/root/store_test.go index 5d610b64c0ff..9bb17dca0345 100644 --- a/store/root/store_test.go +++ b/store/root/store_test.go @@ -12,6 +12,8 @@ import ( "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/commitment" "cosmossdk.io/store/v2/commitment/iavl" + "cosmossdk.io/store/v2/pruning" + "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/sqlite" ) @@ -28,14 +30,15 @@ func TestStorageTestSuite(t *testing.T) { func (s *RootStoreTestSuite) SetupTest() { noopLog := log.NewNopLogger() - ss, err := sqlite.New(s.T().TempDir()) + sqliteDB, err := sqlite.New(s.T().TempDir()) s.Require().NoError(err) + ss := storage.NewStorageStore(sqliteDB) tree := iavl.NewIavlTree(dbm.NewMemDB(), noopLog, iavl.DefaultConfig()) - sc, err := commitment.NewCommitStore(map[string]commitment.Tree{"default": tree}, noopLog) + sc, err := commitment.NewCommitStore(map[string]commitment.Tree{defaultStoreKey: tree}, noopLog) s.Require().NoError(err) - rs, err := New(noopLog, 1, ss, sc, nil) + rs, err := New(noopLog, ss, sc, pruning.DefaultOptions(), pruning.DefaultOptions(), nil) s.Require().NoError(err) rs.SetTracer(io.Discard) @@ -51,12 +54,8 @@ func (s *RootStoreTestSuite) TearDownTest() { s.Require().NoError(err) } -func (s *RootStoreTestSuite) TestMountSCStore() { - s.Require().Error(s.rootStore.MountSCStore("", nil)) -} - func (s *RootStoreTestSuite) TestGetSCStore() { - s.Require().Equal(s.rootStore.GetSCStore(""), s.rootStore.(*Store).stateCommitment) + s.Require().Equal(s.rootStore.GetSCStore(), s.rootStore.(*Store).stateCommitment) } func (s *RootStoreTestSuite) TestGetKVStore() { @@ -90,9 +89,9 @@ func (s *RootStoreTestSuite) TestQuery() { // ensure the proof is non-nil for the corresponding version result, err := s.rootStore.Query(defaultStoreKey, 1, []byte("foo"), true) s.Require().NoError(err) - s.Require().NotNil(result.Proof) - s.Require().Equal([]byte("foo"), result.Proof.GetExist().Key) - s.Require().Equal([]byte("bar"), result.Proof.GetExist().Value) + s.Require().NotNil(result.Proof.Proof) + s.Require().Equal([]byte("foo"), result.Proof.Proof.GetExist().Key) + s.Require().Equal([]byte("bar"), result.Proof.Proof.GetExist().Value) } func (s *RootStoreTestSuite) TestBranch() { diff --git a/store/snapshots/chunk.go b/store/snapshots/chunk.go index c70fc074b0e0..874bf966871b 100644 --- a/store/snapshots/chunk.go +++ b/store/snapshots/chunk.go @@ -6,7 +6,7 @@ import ( "cosmossdk.io/errors" "cosmossdk.io/store/v2" - snapshottypes "cosmossdk.io/store/v2/snapshots/types" + snapshotstypes "cosmossdk.io/store/v2/snapshots/types" ) // ChunkWriter reads an input stream, splits it into fixed-size chunks, and writes them to a @@ -169,15 +169,15 @@ func DrainChunks(chunks <-chan io.ReadCloser) { // ValidRestoreHeight will check height is valid for snapshot restore or not func ValidRestoreHeight(format uint32, height uint64) error { - if format != snapshottypes.CurrentFormat { - return errors.Wrapf(snapshottypes.ErrUnknownFormat, "format %v", format) + if format != snapshotstypes.CurrentFormat { + return errors.Wrapf(snapshotstypes.ErrUnknownFormat, "format %v", format) } if height == 0 { return errors.Wrap(store.ErrLogic, "cannot restore snapshot at height 0") } if height > uint64(math.MaxInt64) { - return errors.Wrapf(snapshottypes.ErrInvalidMetadata, + return errors.Wrapf(snapshotstypes.ErrInvalidMetadata, "snapshot height %v cannot exceed %v", height, int64(math.MaxInt64)) } diff --git a/store/snapshots/helpers_test.go b/store/snapshots/helpers_test.go index 7c6cf04bcd72..9711ab538347 100644 --- a/store/snapshots/helpers_test.go +++ b/store/snapshots/helpers_test.go @@ -17,8 +17,9 @@ import ( errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" + "cosmossdk.io/store/v2" "cosmossdk.io/store/v2/snapshots" - snapshottypes "cosmossdk.io/store/v2/snapshots/types" + snapshotstypes "cosmossdk.io/store/v2/snapshots/types" ) func checksums(slice [][]byte) [][]byte { @@ -62,7 +63,7 @@ func readChunks(chunks <-chan io.ReadCloser) [][]byte { } // snapshotItems serialize a array of bytes as SnapshotItem_ExtensionPayload, and return the chunks. -func snapshotItems(items [][]byte, ext snapshottypes.ExtensionSnapshotter) [][]byte { +func snapshotItems(items [][]byte, ext snapshots.ExtensionSnapshotter) [][]byte { // copy the same parameters from the code snapshotChunkSize := uint64(10e6) snapshotBufferSize := int(snapshotChunkSize) @@ -74,19 +75,19 @@ func snapshotItems(items [][]byte, ext snapshottypes.ExtensionSnapshotter) [][]b zWriter, _ := zlib.NewWriterLevel(bufWriter, 7) protoWriter := protoio.NewDelimitedWriter(zWriter) for _, item := range items { - _ = snapshottypes.WriteExtensionPayload(protoWriter, item) + _ = snapshotstypes.WriteExtensionPayload(protoWriter, item) } // write extension metadata - _ = protoWriter.WriteMsg(&snapshottypes.SnapshotItem{ - Item: &snapshottypes.SnapshotItem_Extension{ - Extension: &snapshottypes.SnapshotExtensionMeta{ + _ = protoWriter.WriteMsg(&snapshotstypes.SnapshotItem{ + Item: &snapshotstypes.SnapshotItem_Extension{ + Extension: &snapshotstypes.SnapshotExtensionMeta{ Name: ext.SnapshotName(), Format: ext.SnapshotFormat(), }, }, }) _ = ext.SnapshotExtension(0, func(payload []byte) error { - return snapshottypes.WriteExtensionPayload(protoWriter, payload) + return snapshotstypes.WriteExtensionPayload(protoWriter, payload) }) _ = protoWriter.Close() _ = bufWriter.Flush() @@ -105,23 +106,21 @@ func snapshotItems(items [][]byte, ext snapshottypes.ExtensionSnapshotter) [][]b return chunks } -type mockSnapshotter struct { - items [][]byte - prunedHeights map[int64]struct{} - snapshotInterval uint64 +type mockCommitSnapshotter struct { + items [][]byte } -func (m *mockSnapshotter) Restore( - height uint64, format uint32, protoReader protoio.Reader, -) (snapshottypes.SnapshotItem, error) { +func (m *mockCommitSnapshotter) Restore( + height uint64, format uint32, protoReader protoio.Reader, chStorage chan<- *store.KVPair, +) (snapshotstypes.SnapshotItem, error) { if format == 0 { - return snapshottypes.SnapshotItem{}, snapshottypes.ErrUnknownFormat + return snapshotstypes.SnapshotItem{}, snapshotstypes.ErrUnknownFormat } if m.items != nil { - return snapshottypes.SnapshotItem{}, errors.New("already has contents") + return snapshotstypes.SnapshotItem{}, errors.New("already has contents") } - var item snapshottypes.SnapshotItem + var item snapshotstypes.SnapshotItem m.items = [][]byte{} for { item.Reset() @@ -129,7 +128,7 @@ func (m *mockSnapshotter) Restore( if err == io.EOF { break } else if err != nil { - return snapshottypes.SnapshotItem{}, errorsmod.Wrap(err, "invalid protobuf message") + return snapshotstypes.SnapshotItem{}, errorsmod.Wrap(err, "invalid protobuf message") } payload := item.GetExtensionPayload() if payload == nil { @@ -141,65 +140,49 @@ func (m *mockSnapshotter) Restore( return item, nil } -func (m *mockSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error { +func (m *mockCommitSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error { for _, item := range m.items { - if err := snapshottypes.WriteExtensionPayload(protoWriter, item); err != nil { + if err := snapshotstypes.WriteExtensionPayload(protoWriter, item); err != nil { return err } } return nil } -func (m *mockSnapshotter) SnapshotFormat() uint32 { - return snapshottypes.CurrentFormat +func (m *mockCommitSnapshotter) SnapshotFormat() uint32 { + return snapshotstypes.CurrentFormat } -func (m *mockSnapshotter) SupportedFormats() []uint32 { - return []uint32{snapshottypes.CurrentFormat} +func (m *mockCommitSnapshotter) SupportedFormats() []uint32 { + return []uint32{snapshotstypes.CurrentFormat} } -func (m *mockSnapshotter) PruneSnapshotHeight(height int64) { - m.prunedHeights[height] = struct{}{} -} - -func (m *mockSnapshotter) GetSnapshotInterval() uint64 { - return m.snapshotInterval -} +type mockStorageSnapshotter struct{} -func (m *mockSnapshotter) SetSnapshotInterval(snapshotInterval uint64) { - m.snapshotInterval = snapshotInterval +func (m *mockStorageSnapshotter) Restore(version uint64, chStorage <-chan *store.KVPair) error { + return nil } -type mockErrorSnapshotter struct{} +type mockErrorCommitSnapshotter struct{} -var _ snapshottypes.Snapshotter = (*mockErrorSnapshotter)(nil) +var _ snapshots.CommitSnapshotter = (*mockErrorCommitSnapshotter)(nil) -func (m *mockErrorSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error { +func (m *mockErrorCommitSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error { return errors.New("mock snapshot error") } -func (m *mockErrorSnapshotter) Restore( - height uint64, format uint32, protoReader protoio.Reader, -) (snapshottypes.SnapshotItem, error) { - return snapshottypes.SnapshotItem{}, errors.New("mock restore error") -} - -func (m *mockErrorSnapshotter) SnapshotFormat() uint32 { - return snapshottypes.CurrentFormat -} - -func (m *mockErrorSnapshotter) SupportedFormats() []uint32 { - return []uint32{snapshottypes.CurrentFormat} -} - -func (m *mockErrorSnapshotter) PruneSnapshotHeight(height int64) { +func (m *mockErrorCommitSnapshotter) Restore( + height uint64, format uint32, protoReader protoio.Reader, chStorage chan<- *store.KVPair, +) (snapshotstypes.SnapshotItem, error) { + return snapshotstypes.SnapshotItem{}, errors.New("mock restore error") } -func (m *mockErrorSnapshotter) GetSnapshotInterval() uint64 { - return 0 +func (m *mockErrorCommitSnapshotter) SnapshotFormat() uint32 { + return snapshotstypes.CurrentFormat } -func (m *mockErrorSnapshotter) SetSnapshotInterval(snapshotInterval uint64) { +func (m *mockErrorCommitSnapshotter) SupportedFormats() []uint32 { + return []uint32{snapshotstypes.CurrentFormat} } // setupBusyManager creates a manager with an empty store that is busy creating a snapshot at height 1. @@ -208,10 +191,8 @@ func setupBusyManager(t *testing.T) *snapshots.Manager { t.Helper() store, err := snapshots.NewStore(db.NewMemDB(), t.TempDir()) require.NoError(t, err) - hung := newHungSnapshotter() - hung.SetSnapshotInterval(opts.Interval) - mgr := snapshots.NewManager(store, opts, hung, nil, log.NewNopLogger()) - require.Equal(t, opts.Interval, hung.snapshotInterval) + hung := newHungCommitSnapshotter() + mgr := snapshots.NewManager(store, opts, hung, &mockStorageSnapshotter{}, nil, log.NewNopLogger()) // Channel to ensure the test doesn't finish until the goroutine is done. // Without this, there are intermittent test failures about @@ -222,8 +203,6 @@ func setupBusyManager(t *testing.T) *snapshots.Manager { defer close(done) _, err := mgr.Create(1) require.NoError(t, err) - _, didPruneHeight := hung.prunedHeights[1] - require.True(t, didPruneHeight) }() time.Sleep(10 * time.Millisecond) @@ -236,40 +215,29 @@ func setupBusyManager(t *testing.T) *snapshots.Manager { return mgr } -// hungSnapshotter can be used to test operations in progress. Call close to end the snapshot. -type hungSnapshotter struct { - ch chan struct{} - prunedHeights map[int64]struct{} - snapshotInterval uint64 +// hungCommitSnapshotter can be used to test operations in progress. Call close to end the snapshot. +type hungCommitSnapshotter struct { + ch chan struct{} } -func newHungSnapshotter() *hungSnapshotter { - return &hungSnapshotter{ - ch: make(chan struct{}), - prunedHeights: make(map[int64]struct{}), +func newHungCommitSnapshotter() *hungCommitSnapshotter { + return &hungCommitSnapshotter{ + ch: make(chan struct{}), } } -func (m *hungSnapshotter) Close() { +func (m *hungCommitSnapshotter) Close() { close(m.ch) } -func (m *hungSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error { +func (m *hungCommitSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error { <-m.ch return nil } -func (m *hungSnapshotter) PruneSnapshotHeight(height int64) { - m.prunedHeights[height] = struct{}{} -} - -func (m *hungSnapshotter) SetSnapshotInterval(snapshotInterval uint64) { - m.snapshotInterval = snapshotInterval -} - -func (m *hungSnapshotter) Restore( - height uint64, format uint32, protoReader protoio.Reader, -) (snapshottypes.SnapshotItem, error) { +func (m *hungCommitSnapshotter) Restore( + height uint64, format uint32, protoReader protoio.Reader, chStorage chan<- *store.KVPair, +) (snapshotstypes.SnapshotItem, error) { panic("not implemented") } @@ -299,16 +267,16 @@ func (s *extSnapshotter) SupportedFormats() []uint32 { return []uint32{1} } -func (s *extSnapshotter) SnapshotExtension(height uint64, payloadWriter snapshottypes.ExtensionPayloadWriter) error { +func (s *extSnapshotter) SnapshotExtension(height uint64, payloadWriter snapshots.ExtensionPayloadWriter) error { for _, i := range s.state { - if err := payloadWriter(snapshottypes.Uint64ToBigEndian(i)); err != nil { + if err := payloadWriter(snapshotstypes.Uint64ToBigEndian(i)); err != nil { return err } } return nil } -func (s *extSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshottypes.ExtensionPayloadReader) error { +func (s *extSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshots.ExtensionPayloadReader) error { for { payload, err := payloadReader() if err == io.EOF { @@ -316,7 +284,7 @@ func (s *extSnapshotter) RestoreExtension(height uint64, format uint32, payloadR } else if err != nil { return err } - s.state = append(s.state, snapshottypes.BigEndianToUint64(payload)) + s.state = append(s.state, snapshotstypes.BigEndianToUint64(payload)) } // finalize restoration return nil diff --git a/store/snapshots/manager.go b/store/snapshots/manager.go index 8dd1381e1e2b..1c2d4ec65a31 100644 --- a/store/snapshots/manager.go +++ b/store/snapshots/manager.go @@ -31,13 +31,16 @@ import ( // 2. io.ReadCloser streams automatically propagate IO errors, and can pass arbitrary // errors via io.Pipe.CloseWithError(). type Manager struct { - extensions map[string]types.ExtensionSnapshotter + extensions map[string]ExtensionSnapshotter // store is the snapshot store where all completed snapshots are persisted. store *Store - opts types.SnapshotOptions - // multistore is the store from which snapshots are taken. - multistore types.Snapshotter - logger log.Logger + opts SnapshotOptions + // commitSnapshotter is the snapshotter for the commitment state. + commitSnapshotter CommitSnapshotter + // storageSnapshotter is the snapshotter for the storage state. + storageSnapshotter StorageSnapshotter + + logger log.Logger mtx sync.Mutex operation operation @@ -62,8 +65,9 @@ const ( opPrune operation = "prune" opRestore operation = "restore" - chunkBufferSize = 4 - chunkIDBufferSize = 1024 + chunkBufferSize = 4 + chunkIDBufferSize = 1024 + defaultStorageChannelBufferSize = 1024 snapshotMaxItemSize = int(64e6) // SDK has no key/value size limit, so we set an arbitrary limit ) @@ -71,23 +75,24 @@ const ( var ErrOptsZeroSnapshotInterval = errors.New("snaphot-interval must not be 0") // NewManager creates a new manager. -func NewManager(store *Store, opts types.SnapshotOptions, multistore types.Snapshotter, extensions map[string]types.ExtensionSnapshotter, logger log.Logger) *Manager { +func NewManager(store *Store, opts SnapshotOptions, commitSnapshotter CommitSnapshotter, storageSnapshotter StorageSnapshotter, extensions map[string]ExtensionSnapshotter, logger log.Logger) *Manager { if extensions == nil { - extensions = map[string]types.ExtensionSnapshotter{} + extensions = map[string]ExtensionSnapshotter{} } return &Manager{ - store: store, - opts: opts, - multistore: multistore, - extensions: extensions, - logger: logger, + store: store, + opts: opts, + commitSnapshotter: commitSnapshotter, + storageSnapshotter: storageSnapshotter, + extensions: extensions, + logger: logger.With("module", "snapshot_manager"), } } // RegisterExtensions register extension snapshotters to manager -func (m *Manager) RegisterExtensions(extensions ...types.ExtensionSnapshotter) error { +func (m *Manager) RegisterExtensions(extensions ...ExtensionSnapshotter) error { if m.extensions == nil { - m.extensions = make(map[string]types.ExtensionSnapshotter, len(extensions)) + m.extensions = make(map[string]ExtensionSnapshotter, len(extensions)) } for _, extension := range extensions { name := extension.SnapshotName() @@ -161,11 +166,9 @@ func (m *Manager) GetSnapshotBlockRetentionHeights() int64 { // Create creates a snapshot and returns its metadata. func (m *Manager) Create(height uint64) (*types.Snapshot, error) { if m == nil { - return nil, errorsmod.Wrap(store.ErrLogic, "no snapshot store configured") + return nil, errorsmod.Wrap(store.ErrLogic, "Snapshot Manager is nil") } - defer m.multistore.PruneSnapshotHeight(int64(height)) - err := m.begin(opSnapshot) if err != nil { return nil, err @@ -201,7 +204,7 @@ func (m *Manager) createSnapshot(height uint64, ch chan<- io.ReadCloser) { } }() - if err := m.multistore.Snapshot(height, streamWriter); err != nil { + if err := m.commitSnapshotter.Snapshot(height, streamWriter); err != nil { streamWriter.CloseWithError(err) return } @@ -363,7 +366,20 @@ func (m *Manager) doRestoreSnapshot(snapshot types.Snapshot, chChunks <-chan io. return payload.Payload, nil } - nextItem, err = m.multistore.Restore(snapshot.Height, snapshot.Format, streamReader) + // chStorage is the channel to pass the KV pairs to the storage snapshotter. + chStorage := make(chan *store.KVPair, defaultStorageChannelBufferSize) + defer close(chStorage) + + storageErrs := make(chan error, 1) + go func() { + defer close(storageErrs) + err := m.storageSnapshotter.Restore(snapshot.Height, chStorage) + if err != nil { + storageErrs <- err + } + }() + + nextItem, err = m.commitSnapshotter.Restore(snapshot.Height, snapshot.Format, streamReader, chStorage) if err != nil { return errorsmod.Wrap(err, "multistore restore") } @@ -393,6 +409,12 @@ func (m *Manager) doRestoreSnapshot(snapshot types.Snapshot, chChunks <-chan io. return errorsmod.Wrapf(err, "extension %s don't exhausted payload stream", metadata.Name) } } + + // wait for storage snapshotter to complete + if err := <-storageErrs; err != nil { + return errorsmod.Wrap(err, "storage snapshotter") + } + return nil } @@ -495,7 +517,7 @@ func (m *Manager) sortedExtensionNames() []string { } // IsFormatSupported returns if the snapshotter supports restoration from given format. -func IsFormatSupported(snapshotter types.ExtensionSnapshotter, format uint32) bool { +func IsFormatSupported(snapshotter ExtensionSnapshotter, format uint32) bool { for _, i := range snapshotter.SupportedFormats() { if i == format { return true diff --git a/store/snapshots/manager_test.go b/store/snapshots/manager_test.go index c3276d01ed7e..af5b6eb1e130 100644 --- a/store/snapshots/manager_test.go +++ b/store/snapshots/manager_test.go @@ -13,14 +13,13 @@ import ( "cosmossdk.io/store/v2/snapshots/types" ) -var opts = types.NewSnapshotOptions(1500, 2) +var opts = snapshots.NewSnapshotOptions(1500, 2) func TestManager_List(t *testing.T) { store := setupStore(t) - snapshotter := &mockSnapshotter{} - snapshotter.SetSnapshotInterval(opts.Interval) - manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) - require.Equal(t, opts.Interval, snapshotter.GetSnapshotInterval()) + commitSnapshotter := &mockCommitSnapshotter{} + storageSnapshotter := &mockStorageSnapshotter{} + manager := snapshots.NewManager(store, opts, commitSnapshotter, storageSnapshotter, nil, log.NewNopLogger()) mgrList, err := manager.List() require.NoError(t, err) @@ -41,7 +40,7 @@ func TestManager_List(t *testing.T) { func TestManager_LoadChunk(t *testing.T) { store := setupStore(t) - manager := snapshots.NewManager(store, opts, &mockSnapshotter{}, nil, log.NewNopLogger()) + manager := snapshots.NewManager(store, opts, &mockCommitSnapshotter{}, &mockStorageSnapshotter{}, nil, log.NewNopLogger()) // Existing chunk should return body chunk, err := manager.LoadChunk(2, 1, 1) @@ -67,14 +66,13 @@ func TestManager_Take(t *testing.T) { {4, 5, 6}, {7, 8, 9}, } - snapshotter := &mockSnapshotter{ - items: items, - prunedHeights: make(map[int64]struct{}), + commitSnapshotter := &mockCommitSnapshotter{ + items: items, } extSnapshotter := newExtSnapshotter(10) expectChunks := snapshotItems(items, extSnapshotter) - manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) + manager := snapshots.NewManager(store, opts, commitSnapshotter, &mockStorageSnapshotter{}, nil, log.NewNopLogger()) err := manager.RegisterExtensions(extSnapshotter) require.NoError(t, err) @@ -85,18 +83,14 @@ func TestManager_Take(t *testing.T) { // creating a snapshot at a lower height than the latest should error _, err = manager.Create(3) require.Error(t, err) - _, didPruneHeight := snapshotter.prunedHeights[3] - require.True(t, didPruneHeight) // creating a snapshot at a higher height should be fine, and should return it snapshot, err := manager.Create(5) require.NoError(t, err) - _, didPruneHeight = snapshotter.prunedHeights[5] - require.True(t, didPruneHeight) assert.Equal(t, &types.Snapshot{ Height: 5, - Format: snapshotter.SnapshotFormat(), + Format: commitSnapshotter.SnapshotFormat(), Chunks: 1, Hash: []uint8{0xc5, 0xf7, 0xfe, 0xea, 0xd3, 0x4d, 0x3e, 0x87, 0xff, 0x41, 0xa2, 0x27, 0xfa, 0xcb, 0x38, 0x17, 0xa, 0x5, 0xeb, 0x27, 0x4e, 0x16, 0x5e, 0xf3, 0xb2, 0x8b, 0x47, 0xd1, 0xe6, 0x94, 0x7e, 0x8b}, Metadata: types.Metadata{ @@ -117,9 +111,7 @@ func TestManager_Take(t *testing.T) { func TestManager_Prune(t *testing.T) { store := setupStore(t) - snapshotter := &mockSnapshotter{} - snapshotter.SetSnapshotInterval(opts.Interval) - manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) + manager := snapshots.NewManager(store, opts, &mockCommitSnapshotter{}, &mockStorageSnapshotter{}, nil, log.NewNopLogger()) pruned, err := manager.Prune(2) require.NoError(t, err) @@ -137,11 +129,9 @@ func TestManager_Prune(t *testing.T) { func TestManager_Restore(t *testing.T) { store := setupStore(t) - target := &mockSnapshotter{ - prunedHeights: make(map[int64]struct{}), - } + target := &mockCommitSnapshotter{} extSnapshotter := newExtSnapshotter(0) - manager := snapshots.NewManager(store, opts, target, nil, log.NewNopLogger()) + manager := snapshots.NewManager(store, opts, target, &mockStorageSnapshotter{}, nil, log.NewNopLogger()) err := manager.RegisterExtensions(extSnapshotter) require.NoError(t, err) @@ -191,8 +181,6 @@ func TestManager_Restore(t *testing.T) { // While the restore is in progress, any other operations fail _, err = manager.Create(4) require.Error(t, err) - _, didPruneHeight := target.prunedHeights[4] - require.True(t, didPruneHeight) _, err = manager.Prune(1) require.Error(t, err) @@ -248,10 +236,10 @@ func TestManager_Restore(t *testing.T) { } func TestManager_TakeError(t *testing.T) { - snapshotter := &mockErrorSnapshotter{} + snapshotter := &mockErrorCommitSnapshotter{} store, err := snapshots.NewStore(db.NewMemDB(), GetTempDir(t)) require.NoError(t, err) - manager := snapshots.NewManager(store, opts, snapshotter, nil, log.NewNopLogger()) + manager := snapshots.NewManager(store, opts, snapshotter, &mockStorageSnapshotter{}, nil, log.NewNopLogger()) _, err = manager.Create(1) require.Error(t, err) diff --git a/store/snapshots/types/options.go b/store/snapshots/options.go similarity index 96% rename from store/snapshots/types/options.go rename to store/snapshots/options.go index 9c6ec79a11e2..565a0ce105de 100644 --- a/store/snapshots/types/options.go +++ b/store/snapshots/options.go @@ -1,4 +1,4 @@ -package types +package snapshots // SnapshotOptions defines the snapshot strategy used when determining which // heights are snapshotted for state sync. diff --git a/store/snapshots/types/snapshotter.go b/store/snapshots/snapshotter.go similarity index 55% rename from store/snapshots/types/snapshotter.go rename to store/snapshots/snapshotter.go index de9fcfe3d3ff..7c8321f3c838 100644 --- a/store/snapshots/types/snapshotter.go +++ b/store/snapshots/snapshotter.go @@ -1,29 +1,26 @@ -package types +package snapshots import ( protoio "github.com/cosmos/gogoproto/io" + + "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/snapshots/types" ) -// Snapshotter is something that can create and restore snapshots, consisting of streamed binary -// chunks - all of which must be read from the channel and closed. If an unsupported format is -// given, it must return ErrUnknownFormat (possibly wrapped with fmt.Errorf). -type Snapshotter interface { - // Snapshot writes snapshot items into the protobuf writer. - Snapshot(height uint64, protoWriter protoio.Writer) error - - // PruneSnapshotHeight prunes the given height according to the prune strategy. - // If PruneNothing, this is a no-op. - // If other strategy, this height is persisted until it is - // less than - KeepRecent and % Interval == 0 - PruneSnapshotHeight(height int64) - - // SetSnapshotInterval sets the interval at which the snapshots are taken. - // It is used by the store that implements the Snapshotter interface - // to determine which heights to retain until after the snapshot is complete. - SetSnapshotInterval(snapshotInterval uint64) - - // Restore restores a state snapshot, taking the reader of protobuf message stream as input. - Restore(height uint64, format uint32, protoReader protoio.Reader) (SnapshotItem, error) +// CommitSnapshotter defines an API for creating and restoring snapshots of the +// commitment state. +type CommitSnapshotter interface { + // Snapshot writes a snapshot of the commitment state at the given version. + Snapshot(version uint64, protoWriter protoio.Writer) error + + // Restore restores the commitment state from the snapshot reader. + Restore(version uint64, format uint32, protoReader protoio.Reader, chStorage chan<- *store.KVPair) (types.SnapshotItem, error) +} + +// StorageSnapshotter defines an API for restoring snapshots of the storage state. +type StorageSnapshotter interface { + // Restore restores the storage state from the given channel. + Restore(version uint64, chStorage <-chan *store.KVPair) error } // ExtensionPayloadReader read extension payloads, diff --git a/store/storage/database.go b/store/storage/database.go new file mode 100644 index 000000000000..884981f6138f --- /dev/null +++ b/store/storage/database.go @@ -0,0 +1,25 @@ +package storage + +import ( + "io" + + "cosmossdk.io/store/v2" +) + +// Database is an interface that wraps the storage database methods. A wrapper +// is useful for instances where you want to perform logic that is identical for all SS +// backends, such as restoring snapshots. +type Database interface { + NewBatch(version uint64) (store.Batch, error) + Has(storeKey string, version uint64, key []byte) (bool, error) + Get(storeKey string, version uint64, key []byte) ([]byte, error) + GetLatestVersion() (uint64, error) + SetLatestVersion(version uint64) error + + Iterator(storeKey string, version uint64, start, end []byte) (store.Iterator, error) + ReverseIterator(storeKey string, version uint64, start, end []byte) (store.Iterator, error) + + Prune(version uint64) error + + io.Closer +} diff --git a/store/storage/pebbledb/db.go b/store/storage/pebbledb/db.go index 4e61857f9352..42b9a2812ca4 100644 --- a/store/storage/pebbledb/db.go +++ b/store/storage/pebbledb/db.go @@ -11,6 +11,7 @@ import ( "github.com/cockroachdb/pebble" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/storage" ) const ( @@ -25,7 +26,7 @@ const ( tombstoneVal = "TOMBSTONE" ) -var _ store.VersionedDatabase = (*Database)(nil) +var _ storage.Database = (*Database)(nil) type Database struct { storage *pebble.DB @@ -92,6 +93,15 @@ func (db *Database) Close() error { return err } +func (db *Database) NewBatch(version uint64) (store.Batch, error) { + b, err := NewBatch(db.storage, version, db.sync) + if err != nil { + return nil, err + } + + return b, nil +} + func (db *Database) SetLatestVersion(version uint64) error { var ts [VersionSize]byte binary.LittleEndian.PutUint64(ts[:], version) @@ -175,29 +185,6 @@ func (db *Database) Get(storeKey string, targetVersion uint64, key []byte) ([]by return nil, nil } -func (db *Database) ApplyChangeset(version uint64, cs *store.Changeset) error { - b, err := NewBatch(db.storage, version, db.sync) - if err != nil { - return err - } - - for storeKey, pairs := range cs.Pairs { - for _, kvPair := range pairs { - if kvPair.Value == nil { - if err := b.Delete(storeKey, kvPair.Key); err != nil { - return err - } - } else { - if err := b.Set(storeKey, kvPair.Key, kvPair.Value); err != nil { - return err - } - } - } - } - - return b.Write() -} - // Prune removes all versions of all keys that are <= the given version. // // Note, the implementation of this method is inefficient and can be potentially diff --git a/store/storage/pebbledb/db_test.go b/store/storage/pebbledb/db_test.go index 934660042167..a8310386bc37 100644 --- a/store/storage/pebbledb/db_test.go +++ b/store/storage/pebbledb/db_test.go @@ -19,7 +19,7 @@ func TestStorageTestSuite(t *testing.T) { db.SetSync(false) } - return db, err + return storage.NewStorageStore(db), err }, EmptyBatchSize: 12, } diff --git a/store/storage/rocksdb/db.go b/store/storage/rocksdb/db.go index d73fd29be5ee..d1806cce1e2d 100644 --- a/store/storage/rocksdb/db.go +++ b/store/storage/rocksdb/db.go @@ -12,6 +12,7 @@ import ( "golang.org/x/exp/slices" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/util" ) @@ -23,7 +24,7 @@ const ( ) var ( - _ store.VersionedDatabase = (*Database)(nil) + _ storage.Database = (*Database)(nil) defaultWriteOpts = grocksdb.NewDefaultWriteOptions() defaultReadOpts = grocksdb.NewDefaultReadOptions() @@ -90,6 +91,10 @@ func (db *Database) Close() error { return nil } +func (db *Database) NewBatch(version uint64) (store.Batch, error) { + return NewBatch(db, version), nil +} + func (db *Database) getSlice(storeKey string, version uint64, key []byte) (*grocksdb.Slice, error) { if version < db.tsLow { return nil, store.ErrVersionPruned{EarliestVersion: db.tsLow} @@ -141,26 +146,6 @@ func (db *Database) Get(storeKey string, version uint64, key []byte) ([]byte, er return copyAndFreeSlice(slice), nil } -func (db *Database) ApplyChangeset(version uint64, cs *store.Changeset) error { - b := NewBatch(db, version) - - for storeKey, pairs := range cs.Pairs { - for _, kvPair := range pairs { - if kvPair.Value == nil { - if err := b.Delete(storeKey, kvPair.Key); err != nil { - return err - } - } else { - if err := b.Set(storeKey, kvPair.Key, kvPair.Value); err != nil { - return err - } - } - } - } - - return b.Write() -} - // Prune attempts to prune all versions up to and including the provided version. // This is done internally by updating the full_history_ts_low RocksDB value on // the column families, s.t. all versions less than full_history_ts_low will be diff --git a/store/storage/rocksdb/db_test.go b/store/storage/rocksdb/db_test.go index c1d2868cc68f..8788bfe632e2 100644 --- a/store/storage/rocksdb/db_test.go +++ b/store/storage/rocksdb/db_test.go @@ -21,7 +21,8 @@ const ( func TestStorageTestSuite(t *testing.T) { s := &storage.StorageTestSuite{ NewDB: func(dir string) (store.VersionedDatabase, error) { - return New(dir) + db, err := New(dir) + return storage.NewStorageStore(db), err }, EmptyBatchSize: 12, } @@ -33,15 +34,15 @@ func TestDatabase_ReverseIterator(t *testing.T) { require.NoError(t, err) defer db.Close() - cs := store.NewChangeset(map[string]store.KVPairs{storeKey1: {}}) + batch := NewBatch(db, 1) for i := 0; i < 100; i++ { key := fmt.Sprintf("key%03d", i) // key000, key001, ..., key099 val := fmt.Sprintf("val%03d", i) // val000, val001, ..., val099 - cs.AddKVPair(storeKey1, store.KVPair{Key: []byte(key), Value: []byte(val)}) + require.NoError(t, batch.Set(storeKey1, []byte(key), []byte(val))) } - require.NoError(t, db.ApplyChangeset(1, cs)) + require.NoError(t, batch.Write()) // reverse iterator without an end key iter, err := db.ReverseIterator(storeKey1, 1, []byte("key000"), nil) diff --git a/store/storage/sqlite/db.go b/store/storage/sqlite/db.go index 9a1c3421b806..05fde45b03fd 100644 --- a/store/storage/sqlite/db.go +++ b/store/storage/sqlite/db.go @@ -11,6 +11,7 @@ import ( _ "github.com/mattn/go-sqlite3" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/storage" ) const ( @@ -40,7 +41,7 @@ const ( ` ) -var _ store.VersionedDatabase = (*Database)(nil) +var _ storage.Database = (*Database)(nil) type Database struct { storage *sql.DB @@ -91,6 +92,10 @@ func (db *Database) Close() error { return err } +func (db *Database) NewBatch(version uint64) (store.Batch, error) { + return NewBatch(db.storage, version) +} + func (db *Database) GetLatestVersion() (uint64, error) { stmt, err := db.storage.Prepare("SELECT value FROM state_storage WHERE store_key = ? AND key = ?") if err != nil { @@ -168,29 +173,6 @@ func (db *Database) Get(storeKey string, targetVersion uint64, key []byte) ([]by return nil, nil } -func (db *Database) ApplyChangeset(version uint64, cs *store.Changeset) error { - b, err := NewBatch(db.storage, version) - if err != nil { - return err - } - - for storeKey, pairs := range cs.Pairs { - for _, kvPair := range pairs { - if kvPair.Value == nil { - if err := b.Delete(storeKey, kvPair.Key); err != nil { - return err - } - } else { - if err := b.Set(storeKey, kvPair.Key, kvPair.Value); err != nil { - return err - } - } - } - } - - return b.Write() -} - // Prune removes all versions of all keys that are <= the given version. It keeps // the latest (non-tombstoned) version of each key/value tuple to handle queries // above the prune version. This is analogous to RocksDB full_history_ts_low. diff --git a/store/storage/sqlite/db_test.go b/store/storage/sqlite/db_test.go index f80f88baf7e0..deff98ec4348 100644 --- a/store/storage/sqlite/db_test.go +++ b/store/storage/sqlite/db_test.go @@ -19,7 +19,8 @@ const ( func TestStorageTestSuite(t *testing.T) { s := &storage.StorageTestSuite{ NewDB: func(dir string) (store.VersionedDatabase, error) { - return New(dir) + db, err := New(dir) + return storage.NewStorageStore(db), err }, EmptyBatchSize: 0, } @@ -31,15 +32,16 @@ func TestDatabase_ReverseIterator(t *testing.T) { require.NoError(t, err) defer db.Close() - cs := store.NewChangeset(map[string]store.KVPairs{storeKey1: {}}) + batch, err := db.NewBatch(1) + require.NoError(t, err) for i := 0; i < 100; i++ { key := fmt.Sprintf("key%03d", i) // key000, key001, ..., key099 val := fmt.Sprintf("val%03d", i) // val000, val001, ..., val099 - cs.AddKVPair(storeKey1, store.KVPair{Key: []byte(key), Value: []byte(val)}) + require.NoError(t, batch.Set(storeKey1, []byte(key), []byte(val))) } - require.NoError(t, db.ApplyChangeset(1, cs)) + require.NoError(t, batch.Write()) // reverse iterator without an end key iter, err := db.ReverseIterator(storeKey1, 1, []byte("key000"), nil) @@ -106,15 +108,16 @@ func TestParallelWrites(t *testing.T) { go func(i int) { <-triggerStartCh defer wg.Done() - cs := store.NewChangeset(map[string]store.KVPairs{storeKey1: {}}) + batch, err := db.NewBatch(uint64(i + 1)) + require.NoError(t, err) for j := 0; j < kvCount; j++ { key := fmt.Sprintf("key-%d-%03d", i, j) val := fmt.Sprintf("val-%d-%03d", i, j) - cs.AddKVPair(storeKey1, store.KVPair{Key: []byte(key), Value: []byte(val)}) + require.NoError(t, batch.Set(storeKey1, []byte(key), []byte(val))) } - require.NoError(t, db.ApplyChangeset(uint64(i+1), cs)) + require.NoError(t, batch.Write()) }(i) } @@ -155,15 +158,16 @@ func TestParallelWriteAndPruning(t *testing.T) { <-triggerStartCh defer wg.Done() for i := 0; i < latestVersion; i++ { - cs := store.NewChangeset(map[string]store.KVPairs{storeKey1: {}}) + batch, err := db.NewBatch(uint64(i + 1)) + require.NoError(t, err) for j := 0; j < kvCount; j++ { key := fmt.Sprintf("key-%d-%03d", i, j) val := fmt.Sprintf("val-%d-%03d", i, j) - cs.AddKVPair(storeKey1, store.KVPair{Key: []byte(key), Value: []byte(val)}) + require.NoError(t, batch.Set(storeKey1, []byte(key), []byte(val))) } - require.NoError(t, db.ApplyChangeset(uint64(i+1), cs)) + require.NoError(t, batch.Write()) } }() // start a goroutine that prunes the database diff --git a/store/storage/storage_bench_test.go b/store/storage/storage_bench_test.go index 08ba4c8093ac..5639d5d4e84f 100644 --- a/store/storage/storage_bench_test.go +++ b/store/storage/storage_bench_test.go @@ -1,7 +1,7 @@ //go:build rocksdb // +build rocksdb -package storage +package storage_test import ( "bytes" @@ -13,21 +13,29 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/storage" "cosmossdk.io/store/v2/storage/pebbledb" "cosmossdk.io/store/v2/storage/rocksdb" "cosmossdk.io/store/v2/storage/sqlite" ) +const ( + storeKey1 = "store1" +) + var ( backends = map[string]func(dataDir string) (store.VersionedDatabase, error){ "rocksdb_versiondb_opts": func(dataDir string) (store.VersionedDatabase, error) { - return rocksdb.New(dataDir) + db, err := rocksdb.New(dataDir) + return storage.NewStorageStore(db), err }, "pebbledb_default_opts": func(dataDir string) (store.VersionedDatabase, error) { - return pebbledb.New(dataDir) + db, err := pebbledb.New(dataDir) + return storage.NewStorageStore(db), err }, "btree_sqlite": func(dataDir string) (store.VersionedDatabase, error) { - return sqlite.New(dataDir) + db, err := sqlite.New(dataDir) + return storage.NewStorageStore(db), err }, } rng = rand.New(rand.NewSource(567320)) diff --git a/store/storage/store.go b/store/storage/store.go new file mode 100644 index 000000000000..3a6fed65db2d --- /dev/null +++ b/store/storage/store.go @@ -0,0 +1,130 @@ +package storage + +import ( + "fmt" + + "cosmossdk.io/store/v2" + "cosmossdk.io/store/v2/snapshots" +) + +const ( + // TODO: it is a random number, need to be tuned + defaultBatchBufferSize = 100000 +) + +var ( + _ store.VersionedDatabase = (*StorageStore)(nil) + _ snapshots.StorageSnapshotter = (*StorageStore)(nil) +) + +// StorageStore is a wrapper around the store.VersionedDatabase interface. +type StorageStore struct { + db Database +} + +// NewStorageStore returns a reference to a new StorageStore. +func NewStorageStore(db Database) *StorageStore { + return &StorageStore{ + db: db, + } +} + +// Has returns true if the key exists in the store. +func (ss *StorageStore) Has(storeKey string, version uint64, key []byte) (bool, error) { + return ss.db.Has(storeKey, version, key) +} + +// Get returns the value associated with the given key. +func (ss *StorageStore) Get(storeKey string, version uint64, key []byte) ([]byte, error) { + return ss.db.Get(storeKey, version, key) +} + +// ApplyChangeset applies the given changeset to the storage. +func (ss *StorageStore) ApplyChangeset(version uint64, cs *store.Changeset) error { + b, err := ss.db.NewBatch(version) + if err != nil { + return err + } + + for storeKey, pairs := range cs.Pairs { + for _, kvPair := range pairs { + if kvPair.Value == nil { + if err := b.Delete(storeKey, kvPair.Key); err != nil { + return err + } + } else { + if err := b.Set(storeKey, kvPair.Key, kvPair.Value); err != nil { + return err + } + } + } + } + + return b.Write() +} + +// GetLatestVersion returns the latest version of the store. +func (ss *StorageStore) GetLatestVersion() (uint64, error) { + return ss.db.GetLatestVersion() +} + +// SetLatestVersion sets the latest version of the store. +func (ss *StorageStore) SetLatestVersion(version uint64) error { + return ss.db.SetLatestVersion(version) +} + +// Iterator returns an iterator over the specified domain and prefix. +func (ss *StorageStore) Iterator(storeKey string, version uint64, start, end []byte) (store.Iterator, error) { + return ss.db.Iterator(storeKey, version, start, end) +} + +// ReverseIterator returns an iterator over the specified domain and prefix in reverse. +func (ss *StorageStore) ReverseIterator(storeKey string, version uint64, start, end []byte) (store.Iterator, error) { + return ss.db.ReverseIterator(storeKey, version, start, end) +} + +// Prune prunes the store up to the given version. +func (ss *StorageStore) Prune(version uint64) error { + return ss.db.Prune(version) +} + +// Restore restores the store from the given channel. +func (ss *StorageStore) Restore(version uint64, chStorage <-chan *store.KVPair) error { + latestVersion, err := ss.db.GetLatestVersion() + if err != nil { + return fmt.Errorf("failed to get latest version: %w", err) + } + if version <= latestVersion { + return fmt.Errorf("the snapshot version %d is not greater than latest version %d", version, latestVersion) + } + + b, err := ss.db.NewBatch(version) + if err != nil { + return err + } + + for kvPair := range chStorage { + if err := b.Set(kvPair.StoreKey, kvPair.Key, kvPair.Value); err != nil { + return err + } + + if b.Size() > defaultBatchBufferSize { + if err := b.Write(); err != nil { + return err + } + } + } + + if b.Size() > 0 { + if err := b.Write(); err != nil { + return err + } + } + + return ss.db.SetLatestVersion(version) +} + +// Close closes the store. +func (ss *StorageStore) Close() error { + return ss.db.Close() +} diff --git a/store/store.go b/store/store.go index 741a4c49b4f9..8bbeda7985ea 100644 --- a/store/store.go +++ b/store/store.go @@ -3,7 +3,8 @@ package store import ( "io" - ics23 "github.com/cosmos/ics23/go" + coreheader "cosmossdk.io/core/header" + "cosmossdk.io/store/v2/metrics" ) // StoreType defines a type of KVStore. @@ -19,14 +20,8 @@ const ( // RootStore defines an abstraction layer containing a State Storage (SS) engine // and one or more State Commitment (SC) engines. type RootStore interface { - // GetSCStore should return the SC backend for the given store key. A RootStore - // implementation may choose to ignore the store key in cases where only a single - // SC backend is used. - GetSCStore(storeKey string) Committer - // MountSCStore should mount the given SC backend for the given store key. For - // implementations that utilize a single SC backend, this method may be optional - // or a no-op. - MountSCStore(storeKey string, sc Committer) error + // GetSCStore should return the SC backend. + GetSCStore() Committer // GetKVStore returns the KVStore for the given store key. If an implementation // chooses to have a single SS backend, the store key may be ignored. GetKVStore(storeKey string) KVStore @@ -61,10 +56,13 @@ type RootStore interface { // GetLatestVersion returns the latest version, i.e. height, committed. GetLatestVersion() (uint64, error) + // SetInitialVersion sets the initial version on the RootStore. + SetInitialVersion(v uint64) error + // SetCommitHeader sets the commit header for the next commit. This call and // implementation is optional. However, it must be supported in cases where // queries based on block time need to be supported. - SetCommitHeader(h CommitHeader) + SetCommitHeader(h *coreheader.Info) // WorkingHash returns the current WIP commitment hash. Depending on the underlying // implementation, this may need to take the current changeset and write it to @@ -80,6 +78,12 @@ type RootStore interface { // be the same as the hash returned by WorkingHash() prior to calling Commit(). Commit() ([]byte, error) + // LastCommitID returns a CommitID pertaining to the last commitment. + LastCommitID() (CommitID, error) + + // SetMetrics sets the telemetry handler on the RootStore. + SetMetrics(m metrics.Metrics) + io.Closer } @@ -173,5 +177,5 @@ type QueryResult struct { Key []byte Value []byte Version uint64 - Proof *ics23.CommitmentProof + Proof CommitmentOp } diff --git a/telemetry/metrics.go b/telemetry/metrics.go index 690acf41d9c3..812ff0abdbd2 100644 --- a/telemetry/metrics.go +++ b/telemetry/metrics.go @@ -4,9 +4,11 @@ import ( "bytes" "encoding/json" "fmt" + "net/http" "time" "github.com/hashicorp/go-metrics" + "github.com/hashicorp/go-metrics/datadog" metricsprom "github.com/hashicorp/go-metrics/prometheus" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/expfmt" @@ -21,8 +23,17 @@ const ( FormatDefault = "" FormatPrometheus = "prometheus" FormatText = "text" + + MetricSinkInMem = "mem" + MetricSinkStatsd = "statsd" + MetricSinkDogsStatsd = "dogstatsd" ) +// DisplayableSink is an interface that defines a method for displaying metrics. +type DisplayableSink interface { + DisplayMetrics(resp http.ResponseWriter, req *http.Request) (any, error) +} + // Config defines the configuration options for application telemetry. type Config struct { // Prefixed with keys to separate services @@ -52,6 +63,17 @@ type Config struct { // Example: // [["chain_id", "cosmoshub-1"]] GlobalLabels [][]string `mapstructure:"global-labels"` + + // MetricsSink defines the type of metrics backend to use. + MetricsSink string `mapstructure:"type" default:"mem"` + + // StatsdAddr defines the address of a statsd server to send metrics to. + // Only utilized if MetricsSink is set to "statsd" or "dogstatsd". + StatsdAddr string `mapstructure:"statsd-addr"` + + // DatadogHostname defines the hostname to use when emitting metrics to + // Datadog. Only utilized if MetricsSink is set to "dogstatsd". + DatadogHostname string `mapstructure:"datadog-hostname"` } // Metrics defines a wrapper around application telemetry functionality. It allows @@ -60,7 +82,7 @@ type Config struct { // by the operator. In addition to the sinks, when a process gets a SIGUSR1, a // dump of formatted recent metrics will be sent to STDERR. type Metrics struct { - memSink *metrics.InmemSink + sink metrics.MetricSink prometheusEnabled bool } @@ -76,12 +98,11 @@ func New(cfg Config) (_ *Metrics, rerr error) { return nil, nil } - if numGlobalLables := len(cfg.GlobalLabels); numGlobalLables > 0 { - parsedGlobalLabels := make([]metrics.Label, numGlobalLables) + if numGlobalLabels := len(cfg.GlobalLabels); numGlobalLabels > 0 { + parsedGlobalLabels := make([]metrics.Label, numGlobalLabels) for i, gl := range cfg.GlobalLabels { parsedGlobalLabels[i] = NewLabel(gl[0], gl[1]) } - globalLabels = parsedGlobalLabels } @@ -89,16 +110,32 @@ func New(cfg Config) (_ *Metrics, rerr error) { metricsConf.EnableHostname = cfg.EnableHostname metricsConf.EnableHostnameLabel = cfg.EnableHostnameLabel - memSink := metrics.NewInmemSink(10*time.Second, time.Minute) - inMemSig := metrics.DefaultInmemSignal(memSink) - defer func() { - if rerr != nil { - inMemSig.Stop() - } - }() + var ( + sink metrics.MetricSink + err error + ) + switch cfg.MetricsSink { + case MetricSinkStatsd: + sink, err = metrics.NewStatsdSink(cfg.StatsdAddr) + case MetricSinkDogsStatsd: + sink, err = datadog.NewDogStatsdSink(cfg.StatsdAddr, cfg.DatadogHostname) + default: + memSink := metrics.NewInmemSink(10*time.Second, time.Minute) + sink = memSink + inMemSig := metrics.DefaultInmemSignal(memSink) + defer func() { + if rerr != nil { + inMemSig.Stop() + } + }() + } + + if err != nil { + return nil, err + } - m := &Metrics{memSink: memSink} - fanout := metrics.FanoutSink{memSink} + m := &Metrics{sink: sink} + fanout := metrics.FanoutSink{sink} if cfg.PrometheusRetentionTime > 0 { m.prometheusEnabled = true @@ -140,6 +177,8 @@ func (m *Metrics) Gather(format string) (GatherResponse, error) { } } +// gatherPrometheus collects Prometheus metrics and returns a GatherResponse. +// If Prometheus metrics are not enabled, it returns an error. func (m *Metrics) gatherPrometheus() (GatherResponse, error) { if !m.prometheusEnabled { return GatherResponse{}, fmt.Errorf("prometheus metrics are not enabled") @@ -154,6 +193,7 @@ func (m *Metrics) gatherPrometheus() (GatherResponse, error) { defer buf.Reset() e := expfmt.NewEncoder(buf, expfmt.FmtText) + for _, mf := range metricsFamilies { if err := e.Encode(mf); err != nil { return GatherResponse{}, fmt.Errorf("failed to encode prometheus metrics: %w", err) @@ -163,8 +203,14 @@ func (m *Metrics) gatherPrometheus() (GatherResponse, error) { return GatherResponse{ContentType: string(expfmt.FmtText), Metrics: buf.Bytes()}, nil } +// gatherGeneric collects generic metrics and returns a GatherResponse. func (m *Metrics) gatherGeneric() (GatherResponse, error) { - summary, err := m.memSink.DisplayMetrics(nil, nil) + gm, ok := m.sink.(DisplayableSink) + if !ok { + return GatherResponse{}, fmt.Errorf("non in-memory metrics sink does not support generic format") + } + + summary, err := gm.DisplayMetrics(nil, nil) if err != nil { return GatherResponse{}, fmt.Errorf("failed to gather in-memory metrics: %w", err) } diff --git a/telemetry/metrics_test.go b/telemetry/metrics_test.go index 2d57fdf5b5b4..1ce1103529c8 100644 --- a/telemetry/metrics_test.go +++ b/telemetry/metrics_test.go @@ -19,6 +19,7 @@ func TestMetrics_Disabled(t *testing.T) { func TestMetrics_InMem(t *testing.T) { m, err := New(Config{ + MetricsSink: MetricSinkInMem, Enabled: true, EnableHostname: false, ServiceName: "test", @@ -42,6 +43,7 @@ func TestMetrics_InMem(t *testing.T) { func TestMetrics_Prom(t *testing.T) { m, err := New(Config{ + MetricsSink: MetricSinkInMem, Enabled: true, EnableHostname: false, ServiceName: "test", diff --git a/tests/e2e/accounts/account_abstraction_test.go b/tests/e2e/accounts/account_abstraction_test.go index 0b0802ffb551..6ccfc5b571eb 100644 --- a/tests/e2e/accounts/account_abstraction_test.go +++ b/tests/e2e/accounts/account_abstraction_test.go @@ -6,22 +6,19 @@ import ( "context" "testing" - rotationv1 "cosmossdk.io/api/cosmos/accounts/testing/rotation/v1" - accountsv1 "cosmossdk.io/api/cosmos/accounts/v1" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" - nftv1beta1 "cosmossdk.io/api/cosmos/nft/v1beta1" - stakingv1beta1 "cosmossdk.io/api/cosmos/staking/v1beta1" "cosmossdk.io/simapp" "cosmossdk.io/x/accounts" + rotationv1 "cosmossdk.io/x/accounts/testing/rotation/v1" + accountsv1 "cosmossdk.io/x/accounts/v1" "cosmossdk.io/x/bank/testutil" + banktypes "cosmossdk.io/x/bank/types" "cosmossdk.io/x/nft" - "github.com/cosmos/cosmos-proto/anyutil" + stakingtypes "cosmossdk.io/x/staking/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" + gogoproto "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" ) var ( @@ -70,13 +67,13 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "secp256k1", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: bundlerAddrStr, Amount: coins(t, "1stake"), // the sender is the AA, so it has the coins and wants to pay the bundler for the gas }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: aliceAddrStr, Amount: coins(t, "2000stake"), // as the real action the sender wants to send coins to alice @@ -103,13 +100,13 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "secp256k1", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: bundlerAddrStr, // abstracted account tries to send money from bundler to itself. ToAddress: aaAddrStr, Amount: coins(t, "1stake"), }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: aliceAddrStr, Amount: coins(t, "2000stake"), // as the real action the sender wants to send coins to alice @@ -130,13 +127,13 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "secp256k1", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: bundlerAddrStr, Amount: coins(t, "1stake"), }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aliceAddrStr, // abstracted account attempts to send money from alice to itself ToAddress: aaAddrStr, Amount: coins(t, "2000stake"), @@ -159,13 +156,13 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "invalid", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: bundlerAddrStr, Amount: coins(t, "1stake"), }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aliceAddrStr, // abstracted account attempts to send money from alice to itself ToAddress: aaAddrStr, Amount: coins(t, "2000stake"), @@ -189,13 +186,13 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "secp256k1", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: bundlerAddrStr, Amount: coins(t, "1atom"), // abstracted account does not have enough money to pay the bundler, since it does not hold atom }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aliceAddrStr, // abstracted account attempts to send money from alice to itself ToAddress: aaAddrStr, Amount: coins(t, "2000stake"), @@ -218,13 +215,13 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "secp256k1", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: bundlerAddrStr, Amount: coins(t, "1stake"), }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaAddrStr, ToAddress: aliceAddrStr, Amount: coins(t, "2000atom"), // abstracted account does not have enough money to pay alice, since it does not hold atom @@ -247,13 +244,13 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "secp256k1", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaFullAddrStr, ToAddress: bundlerAddrStr, Amount: coins(t, "1stake"), // we expect this to fail since the account is implement in such a way not to allow bank sends. }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaFullAddrStr, ToAddress: aliceAddrStr, Amount: coins(t, "2000stake"), @@ -273,7 +270,7 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationGasLimit: 10000, BundlerPaymentMessages: nil, BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &stakingv1beta1.MsgDelegate{ + ExecutionMessages: intoAny(t, &stakingtypes.MsgDelegate{ DelegatorAddress: aaFullAddrStr, ValidatorAddress: "some-validator", Amount: coins(t, "2000stake")[0], @@ -300,14 +297,14 @@ func TestAccountAbstraction(t *testing.T) { AuthenticationMethod: "secp256k1", AuthenticationData: []byte("signature"), AuthenticationGasLimit: 10000, - BundlerPaymentMessages: intoAny(t, &nftv1beta1.MsgSend{ + BundlerPaymentMessages: intoAny(t, &nft.MsgSend{ ClassId: "omega-rare", Id: "the-most-rare", Sender: aaFullAddrStr, Receiver: bundlerAddrStr, }), BundlerPaymentGasLimit: 50000, - ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{ + ExecutionMessages: intoAny(t, &banktypes.MsgSend{ FromAddress: aaFullAddrStr, ToAddress: aliceAddrStr, Amount: coins(t, "2000stake"), @@ -318,28 +315,21 @@ func TestAccountAbstraction(t *testing.T) { }) } -func intoAny(t *testing.T, msgs ...proto.Message) (anys []*anypb.Any) { +func intoAny(t *testing.T, msgs ...gogoproto.Message) (anys []*codectypes.Any) { t.Helper() for _, msg := range msgs { - any, err := anyutil.New(msg) + any, err := codectypes.NewAnyWithValue(msg) require.NoError(t, err) anys = append(anys, any) } return } -func coins(t *testing.T, s string) []*v1beta1.Coin { +func coins(t *testing.T, s string) sdk.Coins { t.Helper() coins, err := sdk.ParseCoinsNormalized(s) require.NoError(t, err) - coinsv2 := make([]*v1beta1.Coin, len(coins)) - for i, coin := range coins { - coinsv2[i] = &v1beta1.Coin{ - Denom: coin.Denom, - Amount: coin.Amount.String(), - } - } - return coinsv2 + return coins } func balanceIs(t *testing.T, ctx context.Context, app *simapp.SimApp, addr sdk.AccAddress, s string) { diff --git a/tests/e2e/accounts/setup_test.go b/tests/e2e/accounts/setup_test.go deleted file mode 100644 index d0588f6825b1..000000000000 --- a/tests/e2e/accounts/setup_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package accounts - -import ( - "testing" - - "cosmossdk.io/simapp" -) - -func setupApp(t *testing.T) *simapp.SimApp { - t.Helper() - app := simapp.Setup(t, false) - return app -} diff --git a/tests/e2e/auth/suite.go b/tests/e2e/auth/suite.go index cee85a1be372..35944b50e25c 100644 --- a/tests/e2e/auth/suite.go +++ b/tests/e2e/auth/suite.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "cosmossdk.io/core/address" "cosmossdk.io/depinject" "cosmossdk.io/math" authcli "cosmossdk.io/x/auth/client/cli" @@ -22,6 +23,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" @@ -40,6 +42,7 @@ type E2ETestSuite struct { suite.Suite cfg network.Config + ac address.Codec network network.NetworkI } @@ -75,6 +78,8 @@ func (s *E2ETestSuite) SetupSuite() { _, err = kb.SaveMultisig("multi", multi) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) + + s.ac = addresscodec.NewBech32Codec("cosmos") } func (s *E2ETestSuite) TearDownSuite() { @@ -874,7 +879,7 @@ func (s *E2ETestSuite) TestCLIMultisignSortSignatures() { var balRes banktypes.QueryAllBalancesResponse err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) s.Require().NoError(err) - intialCoins := balRes.Balances + initialCoins := balRes.Balances // Send coins from validator to multisig. sendTokens := sdk.NewInt64Coin(s.cfg.BondDenom, 10) @@ -891,7 +896,7 @@ func (s *E2ETestSuite) TestCLIMultisignSortSignatures() { s.Require().NoError(err) err = clientCtx.Codec.UnmarshalJSON(resp, &balRes) s.Require().NoError(err) - diff, _ := balRes.Balances.SafeSub(intialCoins...) + diff, _ := balRes.Balances.SafeSub(initialCoins...) s.Require().Equal(sendTokens.Amount, diff.AmountOf(s.cfg.BondDenom)) tokens := sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 5)) @@ -1302,11 +1307,7 @@ func TestGetBroadcastCommandWithoutOfflineFlag(t *testing.T) { // Create new file with tx builder := txCfg.NewTxBuilder() builder.SetGasLimit(200000) - from, err := sdk.AccAddressFromBech32("cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw") - require.NoError(t, err) - to, err := sdk.AccAddressFromBech32("cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw") - require.NoError(t, err) - err = builder.SetMsgs(banktypes.NewMsgSend(from, to, sdk.Coins{sdk.NewInt64Coin("stake", 10000)})) + err = builder.SetMsgs(banktypes.NewMsgSend("cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw", "cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw", sdk.Coins{sdk.NewInt64Coin("stake", 10000)})) require.NoError(t, err) txContents, err := txCfg.TxJSONEncoder()(builder.GetTx()) require.NoError(t, err) @@ -1330,7 +1331,7 @@ func (s *E2ETestSuite) TestTxWithoutPublicKey() { // Create a txBuilder with an unsigned tx. txBuilder := txCfg.NewTxBuilder() - msg := banktypes.NewMsgSend(val1.GetAddress(), val1.GetAddress(), sdk.NewCoins( + msg := banktypes.NewMsgSend(val1.GetAddress().String(), val1.GetAddress().String(), sdk.NewCoins( sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10)), )) err := txBuilder.SetMsgs(msg) @@ -1397,9 +1398,15 @@ func (s *E2ETestSuite) TestSignWithMultiSignersAminoJSON() { // because DIRECT doesn't support multi signers via the CLI. // Since we use amino, we don't need to pre-populate signer_infos. txBuilder := val0.GetClientCtx().TxConfig.NewTxBuilder() - err := txBuilder.SetMsgs( - banktypes.NewMsgSend(val0.GetAddress(), addr1, sdk.NewCoins(val0Coin)), - banktypes.NewMsgSend(val1.GetAddress(), addr1, sdk.NewCoins(val1Coin)), + val0Str, err := s.ac.BytesToString(val0.GetAddress()) + s.Require().NoError(err) + val1Str, err := s.ac.BytesToString(val1.GetAddress()) + s.Require().NoError(err) + addrStr, err := s.ac.BytesToString(addr1) + s.Require().NoError(err) + err = txBuilder.SetMsgs( + banktypes.NewMsgSend(val0Str, addrStr, sdk.NewCoins(val0Coin)), + banktypes.NewMsgSend(val1Str, addrStr, sdk.NewCoins(val1Coin)), ) require.NoError(err) txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10)))) diff --git a/tests/e2e/bank/suite.go b/tests/e2e/bank/suite.go index 2a2ebdaa1c1b..e717bd1f6a4b 100644 --- a/tests/e2e/bank/suite.go +++ b/tests/e2e/bank/suite.go @@ -6,12 +6,14 @@ import ( "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" + "cosmossdk.io/core/address" "cosmossdk.io/math" "cosmossdk.io/x/bank/client/cli" "cosmossdk.io/x/bank/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" @@ -23,6 +25,7 @@ type E2ETestSuite struct { suite.Suite cfg network.Config + ac address.Codec network network.NetworkI } @@ -85,6 +88,7 @@ func (s *E2ETestSuite) SetupSuite() { s.network, err = network.New(s.T(), s.T().TempDir(), s.cfg) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) + s.ac = addresscodec.NewBech32Codec("cosmos") } func (s *E2ETestSuite) TearDownSuite() { @@ -101,10 +105,13 @@ func (s *E2ETestSuite) TestNewSendTxCmdGenOnly() { sdk.NewCoin(fmt.Sprintf("%stoken", val.GetMoniker()), math.NewInt(10)), sdk.NewCoin(s.cfg.BondDenom, math.NewInt(10)), ) - + fromStr, err := s.ac.BytesToString(from) + s.Require().NoError(err) + toStr, err := s.ac.BytesToString(to) + s.Require().NoError(err) msgSend := &types.MsgSend{ - FromAddress: from.String(), - ToAddress: to.String(), + FromAddress: fromStr, + ToAddress: toStr, Amount: amount, } @@ -120,7 +127,7 @@ func (s *E2ETestSuite) TestNewSendTxCmdGenOnly() { tx, err := s.cfg.TxConfig.TxJSONDecoder()(bz.Bytes()) s.Require().NoError(err) - s.Require().Equal([]sdk.Msg{types.NewMsgSend(from, to, amount)}, tx.GetMsgs()) + s.Require().Equal([]sdk.Msg{types.NewMsgSend(fromStr, toStr, amount)}, tx.GetMsgs()) } func (s *E2ETestSuite) TestNewSendTxCmdDryRun() { diff --git a/tests/go.mod b/tests/go.mod index bdc4a5e5301d..b4caa74f85f5 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -14,7 +14,7 @@ require ( cosmossdk.io/store v1.0.1 cosmossdk.io/x/evidence v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/feegrant v0.0.0-20230613133644-0a778132a60f - cosmossdk.io/x/nft v0.0.0-20230613133644-0a778132a60f // indirect + cosmossdk.io/x/nft v0.0.0-20230613133644-0a778132a60f cosmossdk.io/x/protocolpool v0.0.0-20230925135524-a1bc045b3190 cosmossdk.io/x/tx v0.12.0 cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f @@ -28,12 +28,13 @@ require ( github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 google.golang.org/grpc v1.59.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 ) require ( + cosmossdk.io/x/accounts v0.0.0-20231013072015-ec9bcc41ef9c cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 @@ -44,7 +45,7 @@ require ( cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 github.com/google/go-cmp v0.6.0 - github.com/jhump/protoreflect v1.15.3 + github.com/jhump/protoreflect v1.15.4 ) require ( @@ -54,19 +55,20 @@ require ( cloud.google.com/go/iam v1.1.5 // indirect cloud.google.com/go/storage v1.33.0 // indirect cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect - cosmossdk.io/x/accounts v0.0.0-20231013072015-ec9bcc41ef9c // indirect cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f // 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.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // 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.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/bufbuild/protocompile v0.6.0 // indirect + github.com/bufbuild/protocompile v0.7.1 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -156,7 +158,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -183,17 +185,21 @@ require ( 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 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // 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.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/tests/go.sum b/tests/go.sum index cffdd389bc53..63d0a46ef601 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -213,6 +213,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -266,8 +268,8 @@ github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipus 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/bufbuild/protocompile v0.7.1 h1:Kd8fb6EshOHXNNRtYAmLAwy/PotlyFoN0iMbuwGNh0M= +github.com/bufbuild/protocompile v0.7.1/go.mod h1:+Etjg4guZoAqzVk2czwEQP12yaxLJ8DxuqCJ9qHdH94= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= @@ -692,8 +694,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= -github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= +github.com/jhump/protoreflect v1.15.4 h1:mrwJhfQGGljwvR/jPEocli8KA6G9afbQpH8NY2wORcI= +github.com/jhump/protoreflect v1.15.4/go.mod h1:2B+zwrnMY3TTIqEK01OG/d3pyUycQBfDf+bx8fE2DNg= 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= @@ -858,8 +860,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -1026,6 +1028,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= @@ -1671,8 +1677,8 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ 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.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1 h1:fk72uXZyuZiTtW5tgd63jyVK6582lF61nRC/kGv6vCA= +google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1/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= diff --git a/tests/integration/auth/client/cli/suite_test.go b/tests/integration/auth/client/cli/suite_test.go index 350cd833327d..7b1f59e4c14e 100644 --- a/tests/integration/auth/client/cli/suite_test.go +++ b/tests/integration/auth/client/cli/suite_test.go @@ -840,11 +840,8 @@ func (s *CLITestSuite) TestGetBroadcastCommandWithoutOfflineFlag() { // Create new file with tx builder := txCfg.NewTxBuilder() builder.SetGasLimit(200000) - from, err := s.ac.StringToBytes("cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw") - s.Require().NoError(err) - to, err := s.ac.StringToBytes("cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw") - s.Require().NoError(err) - err = builder.SetMsgs(banktypes.NewMsgSend(from, to, sdk.Coins{sdk.NewInt64Coin("stake", 10000)})) + + err := builder.SetMsgs(banktypes.NewMsgSend("cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw", "cosmos1cxlt8kznps92fwu3j6npahx4mjfutydyene2qw", sdk.Coins{sdk.NewInt64Coin("stake", 10000)})) s.Require().NoError(err) txContents, err := txCfg.TxJSONEncoder()(builder.GetTx()) s.Require().NoError(err) @@ -864,12 +861,15 @@ func (s *CLITestSuite) TestGetBroadcastCommandWithoutOfflineFlag() { func (s *CLITestSuite) TestTxWithoutPublicKey() { txCfg := s.clientCtx.TxConfig + valStr, err := s.ac.BytesToString(s.val) + s.Require().NoError(err) + // Create a txBuilder with an unsigned tx. txBuilder := txCfg.NewTxBuilder() - msg := banktypes.NewMsgSend(s.val, s.val, sdk.NewCoins( + msg := banktypes.NewMsgSend(valStr, valStr, sdk.NewCoins( sdk.NewCoin("Stake", math.NewInt(10)), )) - err := txBuilder.SetMsgs(msg) + err = txBuilder.SetMsgs(msg) s.Require().NoError(err) txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin("Stake", math.NewInt(150)))) txBuilder.SetGasLimit(testdata.NewTestGasLimit()) @@ -917,14 +917,21 @@ func (s *CLITestSuite) TestSignWithMultiSignersAminoJSON() { val1Coin := sdk.NewCoin("test2token", math.NewInt(10)) _, _, addr1 := testdata.KeyTestPubAddr() + valStr, err := s.ac.BytesToString(val0) + s.Require().NoError(err) + val1Str, err := s.ac.BytesToString(val1) + s.Require().NoError(err) + + addrStr, err := s.ac.BytesToString(addr1) + s.Require().NoError(err) // Creating a tx with 2 msgs from 2 signers: val0 and val1. // The validators need to sign with SIGN_MODE_LEGACY_AMINO_JSON, // because DIRECT doesn't support multi signers via the CLI. // Since we use amino, we don't need to pre-populate signer_infos. txBuilder := s.clientCtx.TxConfig.NewTxBuilder() - err := txBuilder.SetMsgs( - banktypes.NewMsgSend(val0, addr1, sdk.NewCoins(val0Coin)), - banktypes.NewMsgSend(val1, addr1, sdk.NewCoins(val1Coin)), + err = txBuilder.SetMsgs( + banktypes.NewMsgSend(valStr, addrStr, sdk.NewCoins(val0Coin)), + banktypes.NewMsgSend(val1Str, addrStr, sdk.NewCoins(val1Coin)), ) s.Require().NoError(err) txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(10)))) diff --git a/tests/integration/bank/app_test.go b/tests/integration/bank/app_test.go index c9a41f526cf5..2fc2ad33ff41 100644 --- a/tests/integration/bank/app_test.go +++ b/tests/integration/bank/app_test.go @@ -64,7 +64,7 @@ var ( coins = sdk.Coins{sdk.NewInt64Coin("foocoin", 10)} halfCoins = sdk.Coins{sdk.NewInt64Coin("foocoin", 5)} - sendMsg1 = types.NewMsgSend(addr1, addr2, coins) + sendMsg1 = types.NewMsgSend(addr1.String(), addr2.String(), coins) multiSendMsg1 = &types.MsgMultiSend{ Inputs: []types.Input{types.NewInput(addr1, coins)}, @@ -167,7 +167,11 @@ func TestSendNotEnoughBalance(t *testing.T) { origAccNum := res1.GetAccountNumber() origSeq := res1.GetSequence() - sendMsg := types.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin("foocoin", 100)}) + addr1Str, err := s.AccountKeeper.AddressCodec().BytesToString(addr1) + require.NoError(t, err) + addr2Str, err := s.AccountKeeper.AddressCodec().BytesToString(addr2) + require.NoError(t, err) + sendMsg := types.NewMsgSend(addr1Str, addr2Str, sdk.Coins{sdk.NewInt64Coin("foocoin", 100)}) header := header.Info{Height: baseApp.LastBlockHeight() + 1} txConfig := moduletestutil.MakeTestTxConfig() _, _, err = simtestutil.SignCheckDeliver(t, txConfig, baseApp, header, []sdk.Msg{sendMsg}, "", []uint64{origAccNum}, []uint64{origSeq}, false, false, priv1) @@ -386,7 +390,7 @@ func TestMsgSetSendEnabled(t *testing.T) { "set default send enabled to true", "Change send enabled", "Modify send enabled and set to true", - false, + govv1.ProposalType_PROPOSAL_TYPE_STANDARD, ) require.NoError(t, err, "making goodGovProp") diff --git a/tests/integration/gov/genesis_test.go b/tests/integration/gov/genesis_test.go index c099e0c838c3..32e41f0998fe 100644 --- a/tests/integration/gov/genesis_test.go +++ b/tests/integration/gov/genesis_test.go @@ -77,11 +77,11 @@ func TestImportExportQueues(t *testing.T) { ctx = s1.app.BaseApp.NewContext(false) // Create two proposals, put the second into the voting period - proposal1, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0], false) + proposal1, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID1 := proposal1.Id - proposal2, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0], false) + proposal2, err := s1.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID2 := proposal2.Id diff --git a/tests/integration/gov/keeper/grpc_query_test.go b/tests/integration/gov/keeper/grpc_query_test.go index 2c3c20cbef72..1cf5056bbf5e 100644 --- a/tests/integration/gov/keeper/grpc_query_test.go +++ b/tests/integration/gov/keeper/grpc_query_test.go @@ -12,128 +12,6 @@ import ( "cosmossdk.io/x/gov/types/v1beta1" ) -func TestGRPCQueryTally(t *testing.T) { - t.Parallel() - f := initFixture(t) - - ctx, queryClient := f.ctx, f.queryClient - - addrs, _ := createValidators(t, f, []int64{5, 5, 5}) - - var ( - req *v1.QueryTallyResultRequest - expRes *v1.QueryTallyResultResponse - proposal v1.Proposal - ) - - testCases := []struct { - msg string - malleate func() - expPass bool - expErrMsg string - }{ - { - "empty request", - func() { - req = &v1.QueryTallyResultRequest{} - }, - false, - "proposal id can not be 0", - }, - { - "zero proposal id request", - func() { - req = &v1.QueryTallyResultRequest{ProposalId: 0} - }, - false, - "proposal id can not be 0", - }, - { - "query non existed proposal", - func() { - req = &v1.QueryTallyResultRequest{ProposalId: 1} - }, - false, - "proposal 1 doesn't exist", - }, - { - "create a proposal and get tally", - func() { - var err error - proposal, err = f.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "description", addrs[0], false) - assert.NilError(t, err) - assert.Assert(t, proposal.String() != "") - - req = &v1.QueryTallyResultRequest{ProposalId: proposal.Id} - - tallyResult := v1.EmptyTallyResult() - expRes = &v1.QueryTallyResultResponse{ - Tally: &tallyResult, - } - }, - true, - "", - }, - { - "request tally after few votes", - func() { - proposal.Status = v1.StatusVotingPeriod - err := f.govKeeper.SetProposal(ctx, proposal) - assert.NilError(t, err) - assert.NilError(t, f.govKeeper.AddVote(ctx, proposal.Id, addrs[0], v1.NewNonSplitVoteOption(v1.OptionYes), "")) - assert.NilError(t, f.govKeeper.AddVote(ctx, proposal.Id, addrs[1], v1.NewNonSplitVoteOption(v1.OptionYes), "")) - assert.NilError(t, f.govKeeper.AddVote(ctx, proposal.Id, addrs[2], v1.NewNonSplitVoteOption(v1.OptionYes), "")) - - req = &v1.QueryTallyResultRequest{ProposalId: proposal.Id} - - expRes = &v1.QueryTallyResultResponse{ - Tally: &v1.TallyResult{ - YesCount: math.NewInt(3 * 5 * 1000000).String(), - NoCount: "0", - AbstainCount: "0", - NoWithVetoCount: "0", - }, - } - }, - true, - "", - }, - { - "request final tally after status changed", - func() { - proposal.Status = v1.StatusPassed - err := f.govKeeper.SetProposal(ctx, proposal) - assert.NilError(t, err) - proposal, _ = f.govKeeper.Proposals.Get(ctx, proposal.Id) - - req = &v1.QueryTallyResultRequest{ProposalId: proposal.Id} - - expRes = &v1.QueryTallyResultResponse{ - Tally: proposal.FinalTallyResult, - } - }, - true, - "", - }, - } - - for _, testCase := range testCases { - t.Run(fmt.Sprintf("Case %s", testCase.msg), func(t *testing.T) { - testCase.malleate() - - tally, err := queryClient.TallyResult(gocontext.Background(), req) - - if testCase.expPass { - assert.NilError(t, err) - assert.Equal(t, expRes.String(), tally.String()) - } else { - assert.ErrorContains(t, err, testCase.expErrMsg) - assert.Assert(t, tally == nil) - } - }) - } -} - func TestLegacyGRPCQueryTally(t *testing.T) { t.Parallel() @@ -155,35 +33,11 @@ func TestLegacyGRPCQueryTally(t *testing.T) { expPass bool expErrMsg string }{ - { - "empty request", - func() { - req = &v1beta1.QueryTallyResultRequest{} - }, - false, - "proposal id can not be 0", - }, - { - "zero proposal id request", - func() { - req = &v1beta1.QueryTallyResultRequest{ProposalId: 0} - }, - false, - "proposal id can not be 0", - }, - { - "query non existed proposal", - func() { - req = &v1beta1.QueryTallyResultRequest{ProposalId: 1} - }, - false, - "proposal 1 doesn't exist", - }, { "create a proposal and get tally", func() { var err error - proposal, err = f.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "description", addrs[0], false) + proposal, err = f.govKeeper.SubmitProposal(ctx, TestProposal, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) assert.Assert(t, proposal.String() != "") @@ -221,23 +75,6 @@ func TestLegacyGRPCQueryTally(t *testing.T) { true, "", }, - { - "request final tally after status changed", - func() { - proposal.Status = v1.StatusPassed - err := f.govKeeper.SetProposal(ctx, proposal) - assert.NilError(t, err) - proposal, _ = f.govKeeper.Proposals.Get(ctx, proposal.Id) - - req = &v1beta1.QueryTallyResultRequest{ProposalId: proposal.Id} - - expRes = &v1beta1.QueryTallyResultResponse{ - Tally: v1TallyToV1Beta1Tally(*proposal.FinalTallyResult), - } - }, - true, - "", - }, } for _, testCase := range testCases { @@ -256,16 +93,3 @@ func TestLegacyGRPCQueryTally(t *testing.T) { }) } } - -func v1TallyToV1Beta1Tally(t v1.TallyResult) v1beta1.TallyResult { - yes, _ := math.NewIntFromString(t.YesCount) - no, _ := math.NewIntFromString(t.NoCount) - noWithVeto, _ := math.NewIntFromString(t.NoWithVetoCount) - abstain, _ := math.NewIntFromString(t.AbstainCount) - return v1beta1.TallyResult{ - Yes: yes, - No: no, - NoWithVeto: noWithVeto, - Abstain: abstain, - } -} diff --git a/tests/integration/gov/keeper/tally_test.go b/tests/integration/gov/keeper/tally_test.go index 45f0c28b4b56..3449c7b8ea33 100644 --- a/tests/integration/gov/keeper/tally_test.go +++ b/tests/integration/gov/keeper/tally_test.go @@ -22,7 +22,7 @@ func TestTallyNoOneVotes(t *testing.T) { createValidators(t, f, []int64{5, 5, 5}) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -49,7 +49,7 @@ func TestTallyNoQuorum(t *testing.T) { addrs := simtestutil.AddTestAddrsIncremental(f.bankKeeper, f.stakingKeeper, ctx, 1, math.NewInt(10000000)) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -75,7 +75,7 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) { addrs, _ := createValidators(t, f, []int64{5, 5, 5}) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -104,7 +104,7 @@ func TestTallyOnlyValidators51No(t *testing.T) { valAccAddrs, _ := createValidators(t, f, []int64{5, 6, 0}) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -131,7 +131,7 @@ func TestTallyOnlyValidators51Yes(t *testing.T) { valAccAddrs, _ := createValidators(t, f, []int64{5, 6, 0}) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -159,7 +159,7 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) { valAccAddrs, _ := createValidators(t, f, []int64{6, 6, 7}) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -188,7 +188,7 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) { valAccAddrs, _ := createValidators(t, f, []int64{6, 6, 7}) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -217,7 +217,7 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) { valAccAddrs, _ := createValidators(t, f, []int64{6, 6, 7}) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -247,7 +247,7 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) { valAccAddr1, valAccAddr2 := valAccAddrs[0], valAccAddrs[1] tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", valAccAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -284,7 +284,7 @@ func TestTallyDelgatorOverride(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(ctx) assert.NilError(t, err) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -323,7 +323,7 @@ func TestTallyDelgatorInherit(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(ctx) assert.NilError(t, err) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -365,7 +365,7 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(ctx) assert.NilError(t, err) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -410,7 +410,7 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) { _, err = f.stakingKeeper.EndBlocker(ctx) assert.NilError(t, err) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -456,7 +456,7 @@ func TestTallyJailedValidator(t *testing.T) { assert.NilError(t, f.stakingKeeper.Jail(ctx, sdk.ConsAddress(consAddr))) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -492,7 +492,7 @@ func TestTallyValidatorMultipleDelegations(t *testing.T) { assert.NilError(t, err) tp := TestProposal - proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], false) + proposal, err := f.govKeeper.SubmitProposal(ctx, tp, "", "test", "description", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) assert.NilError(t, err) proposalID := proposal.Id proposal.Status = v1.StatusVotingPeriod @@ -513,7 +513,7 @@ func TestTallyValidatorMultipleDelegations(t *testing.T) { expectedAbstain := f.stakingKeeper.TokensFromConsensusPower(ctx, 0) expectedNo := f.stakingKeeper.TokensFromConsensusPower(ctx, 10) expectedNoWithVeto := f.stakingKeeper.TokensFromConsensusPower(ctx, 0) - expectedTallyResult := v1.NewTallyResult(expectedYes, expectedAbstain, expectedNo, expectedNoWithVeto) + expectedTallyResult := v1.NewTallyResult(expectedYes, expectedAbstain, expectedNo, expectedNoWithVeto, math.ZeroInt()) assert.Assert(t, tallyResults.Equals(expectedTallyResult)) } diff --git a/tests/starship/README.md b/tests/starship/README.md index 504ea7639ec9..3d680719ebe2 100644 --- a/tests/starship/README.md +++ b/tests/starship/README.md @@ -128,7 +128,7 @@ make install * Longer running pods or infra without issues. ### Testing/Infra -* Add more tests based on requirements, port all exsiting adhoc tests to Starship +* Add more tests based on requirements, port all existing adhoc tests to Starship * Add build system into starship (premetive exists) to be able to build the current simapp from the branch * Start from non-empty genesis * Add the concept of `jobs` into Starship config, where we can run predefined jobs against the infra diff --git a/tests/starship/configs/devnet.yaml b/tests/starship/configs/devnet.yaml index d8c80f372ab8..84b06eac7dc8 100644 --- a/tests/starship/configs/devnet.yaml +++ b/tests/starship/configs/devnet.yaml @@ -13,7 +13,7 @@ chains: # todo: faucet seems to throw error with sdk version 0.50, still seems to work image: ghcr.io/cosmology-tech/starship/cosmjs-faucet:v0.31.0 # provide more resources to faucet since the number of validators is higher - # only a single faucet is spun up with the genesis node, so resources wont multiply + # only a single faucet is spun up with the genesis node, so resources won't multiply # with the number of validators resources: cpu: "0.5" diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index 50da9de48f46..b07876a131b8 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -77,7 +77,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -181,7 +183,7 @@ require ( github.com/onsi/gomega v1.27.4 // indirect github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect github.com/opencontainers/runc v1.1.5 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -209,17 +211,21 @@ require ( 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 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // 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.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/tests/starship/tests/go.sum b/tests/starship/tests/go.sum index 605971832199..8d3fa7bc0075 100644 --- a/tests/starship/tests/go.sum +++ b/tests/starship/tests/go.sum @@ -213,6 +213,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -864,8 +866,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -1036,6 +1038,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/tests/starship/tests/transfer_test.go b/tests/starship/tests/transfer_test.go index 6eb6ce567a94..6cfe38641762 100644 --- a/tests/starship/tests/transfer_test.go +++ b/tests/starship/tests/transfer_test.go @@ -44,7 +44,7 @@ func (s *TestSuite) TestChainTokenTransfer() { s.Require().NoError(err) // build tx into the txBuilder - msg := banktypes.NewMsgSend(addr1, addr2, sdk.NewCoins(sdk.NewCoin(denom, math.NewInt(1230000)))) + msg := banktypes.NewMsgSend(addr1.String(), addr2.String(), sdk.NewCoins(sdk.NewCoin(denom, math.NewInt(1230000)))) s.Require().NoError(err) err = txBuilder.SetMsgs(msg) s.Require().NoError(err) diff --git a/testutil/key.go b/testutil/key.go index 5ae8926d1088..8f4c052aeb3b 100644 --- a/testutil/key.go +++ b/testutil/key.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// GenerateCoinKey generates a new key mnemonic along with its addrress. +// GenerateCoinKey generates a new key mnemonic along with its address. func GenerateCoinKey(algo keyring.SignatureAlgo, cdc codec.Codec) (sdk.AccAddress, string, error) { // generate a private key, with mnemonic info, secret, err := keyring.NewInMemory(cdc).NewMnemonic( @@ -28,7 +28,7 @@ func GenerateCoinKey(algo keyring.SignatureAlgo, cdc codec.Codec) (sdk.AccAddres return addr, secret, nil } -// GenerateSaveCoinKey generates a new key mnemonic with its addrress. +// GenerateSaveCoinKey generates a new key mnemonic with its address. // If mnemonic is provided then it's used for key generation. // The key is saved in the keyring. The function returns error if overwrite=true and the key // already exists. diff --git a/testutil/network/network.go b/testutil/network/network.go index 86e964ee449c..12e2bb8c0bb3 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -602,7 +602,7 @@ func New(l Logger, baseDir string, cfg Config) (NetworkI, error) { l.Log("started test network at height:", height) - // Ensure we cleanup incase any test was abruptly halted (e.g. SIGINT) as any + // Ensure we cleanup in case any test was abruptly halted (e.g. SIGINT) as any // defer in a test would not be called. trapSignal(network.Cleanup) diff --git a/tools/confix/CHANGELOG.md b/tools/confix/CHANGELOG.md index 5f0713101c26..e044193f3029 100644 --- a/tools/confix/CHANGELOG.md +++ b/tools/confix/CHANGELOG.md @@ -31,6 +31,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v0.1.1](https://github.com/cosmos/cosmos-sdk/releases/tag/tools/confix/v0.1.1) - 2023-12-11 + * [#18496](https://github.com/cosmos/cosmos-sdk/pull/18496) Remove invalid non SDK config from app.toml migration templates. diff --git a/tools/confix/cmd/migrate_test.go b/tools/confix/cmd/migrate_test.go index 8fc67df8392f..a0e9c545f9f8 100644 --- a/tools/confix/cmd/migrate_test.go +++ b/tools/confix/cmd/migrate_test.go @@ -27,7 +27,7 @@ func TestMigrateCmd(t *testing.T) { _, err = clitestutil.ExecTestCLICmd(clientCtx, cmd.MigrateCommand(), []string{"v0.46", filepath.Join(clientCtx.HomeDir, "config", "unsupported.toml")}) assert.ErrorContains(t, err, "failed to migrate config") - // try to migrate from unspported.toml - it should work and give us a big diff + // try to migrate from unsupported.toml - it should work and give us a big diff out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd.MigrateCommand(), []string{"v0.46", filepath.Join(clientCtx.HomeDir, "config", "unsupported.toml"), "--skip-validate", "--verbose"}) assert.NilError(t, err) assert.Assert(t, strings.Contains(out.String(), "add app-db-backend key")) diff --git a/tools/confix/cmd/view.go b/tools/confix/cmd/view.go index bab2116c0453..0c845ce88015 100644 --- a/tools/confix/cmd/view.go +++ b/tools/confix/cmd/view.go @@ -12,7 +12,7 @@ import ( ) func ViewCommand() *cobra.Command { - flagOutputFomat := "output-format" + flagOutputFormat := "output-format" cmd := &cobra.Command{ Use: "view [config]", @@ -31,7 +31,7 @@ func ViewCommand() *cobra.Command { return err } - if format, _ := cmd.Flags().GetString(flagOutputFomat); format == "toml" { + if format, _ := cmd.Flags().GetString(flagOutputFormat); format == "toml" { cmd.Println(string(file)) return nil } @@ -48,7 +48,7 @@ func ViewCommand() *cobra.Command { } // output flag - cmd.Flags().String(flagOutputFomat, "toml", "Output format (json|toml)") + cmd.Flags().String(flagOutputFormat, "toml", "Output format (json|toml)") return cmd } diff --git a/tools/confix/data/v0.45-app.toml b/tools/confix/data/v0.45-app.toml index b0f6dff8237f..7bf5f724f13a 100644 --- a/tools/confix/data/v0.45-app.toml +++ b/tools/confix/data/v0.45-app.toml @@ -44,7 +44,7 @@ halt-time = 0 # It has no bearing on application state pruning which is determined by the # "pruning-*" configurations. # -# Note: Tendermint block pruning is dependant on this parameter in conjunction +# Note: Tendermint block pruning is dependent on this parameter in conjunction # with the unbonding (safety threshold) period, state pruning and state sync # snapshot parameters to determine the correct minimum value of # ResponseCommit.RetainHeight. diff --git a/tools/confix/data/v0.46-app.toml b/tools/confix/data/v0.46-app.toml index 28a108751900..1274a12543c1 100644 --- a/tools/confix/data/v0.46-app.toml +++ b/tools/confix/data/v0.46-app.toml @@ -43,7 +43,7 @@ halt-time = 0 # It has no bearing on application state pruning which is determined by the # "pruning-*" configurations. # -# Note: Tendermint block pruning is dependant on this parameter in conjunction +# Note: Tendermint block pruning is dependent on this parameter in conjunction # with the unbonding (safety threshold) period, state pruning and state sync # snapshot parameters to determine the correct minimum value of # ResponseCommit.RetainHeight. @@ -172,7 +172,7 @@ enable-fee-suggestion = false # GasToSuggest defines gas limit when calculating the fee gas-to-suggest = 200000 -# DenomToSuggest defines the defult denom for fee suggestion. +# DenomToSuggest defines the default denom for fee suggestion. # Price must be in minimum-gas-prices. denom-to-suggest = "uatom" diff --git a/tools/confix/data/v0.47-app.toml b/tools/confix/data/v0.47-app.toml index 8bf5374f99b9..f06945af069f 100644 --- a/tools/confix/data/v0.47-app.toml +++ b/tools/confix/data/v0.47-app.toml @@ -43,7 +43,7 @@ halt-time = 0 # It has no bearing on application state pruning which is determined by the # "pruning-*" configurations. # -# Note: Tendermint block pruning is dependant on this parameter in conjunction +# Note: Tendermint block pruning is dependent on this parameter in conjunction # with the unbonding (safety threshold) period, state pruning and state sync # snapshot parameters to determine the correct minimum value of # ResponseCommit.RetainHeight. @@ -170,7 +170,7 @@ enable-fee-suggestion = false # GasToSuggest defines gas limit when calculating the fee gas-to-suggest = 200000 -# DenomToSuggest defines the defult denom for fee suggestion. +# DenomToSuggest defines the default denom for fee suggestion. # Price must be in minimum-gas-prices. denom-to-suggest = "uatom" diff --git a/tools/confix/data/v0.50-app.toml b/tools/confix/data/v0.50-app.toml index 08c8fd408c61..9c801a2d74ae 100644 --- a/tools/confix/data/v0.50-app.toml +++ b/tools/confix/data/v0.50-app.toml @@ -47,7 +47,7 @@ halt-time = 0 # It has no bearing on application state pruning which is determined by the # "pruning-*" configurations. # -# Note: CometBFT block pruning is dependant on this parameter in conjunction +# Note: CometBFT block pruning is dependent on this parameter in conjunction # with the unbonding (safety threshold) period, state pruning and state sync # snapshot parameters to determine the correct minimum value of # ResponseCommit.RetainHeight. @@ -108,6 +108,17 @@ prometheus-retention-time = 0 # [["chain_id", "cosmoshub-1"]] global-labels = [] +# MetricsSink defines the type of metrics sink to use. +metrics-sink = "mem" + +# StatsdAddr defines the address of a statsd server to send metrics to. +# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". +statsd-addr = "" + +# DatadogHostname defines the hostname to use when emitting metrics to +# Datadog. Only utilized if MetricsSink is set to "dogstatsd". +datadog-hostname = "" + ############################################################################### ### API Configuration ### ############################################################################### diff --git a/tools/confix/data/v0.51-app.toml b/tools/confix/data/v0.51-app.toml index df90516dc7fc..f725f5bbc5bb 100644 --- a/tools/confix/data/v0.51-app.toml +++ b/tools/confix/data/v0.51-app.toml @@ -47,7 +47,7 @@ halt-time = 0 # It has no bearing on application state pruning which is determined by the # "pruning-*" configurations. # -# Note: CometBFT block pruning is dependant on this parameter in conjunction +# Note: CometBFT block pruning is dependent on this parameter in conjunction # with the unbonding (safety threshold) period, state pruning and state sync # snapshot parameters to determine the correct minimum value of # ResponseCommit.RetainHeight. @@ -108,6 +108,17 @@ prometheus-retention-time = 0 # [["chain_id", "cosmoshub-1"]] global-labels = [] +# MetricsSink defines the type of metrics sink to use. +metrics-sink = "mem" + +# StatsdAddr defines the address of a statsd server to send metrics to. +# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". +statsd-addr = "" + +# DatadogHostname defines the hostname to use when emitting metrics to +# Datadog. Only utilized if MetricsSink is set to "dogstatsd". +datadog-hostname = "" + ############################################################################### ### API Configuration ### ############################################################################### diff --git a/tools/confix/go.mod b/tools/confix/go.mod index a1fba09d6bbd..26135b59625d 100644 --- a/tools/confix/go.mod +++ b/tools/confix/go.mod @@ -6,7 +6,7 @@ require ( github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230614103911-b3da8bb4e801 github.com/creachadair/atomicfile v0.3.2 github.com/creachadair/tomledit v0.0.25 - github.com/pelletier/go-toml/v2 v2.1.0 + github.com/pelletier/go-toml/v2 v2.1.1 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.17.0 golang.org/x/exp v0.0.0-20231127185646-65229373498e diff --git a/tools/confix/go.sum b/tools/confix/go.sum index 7cc68b2a661e..4032b52f6099 100644 --- a/tools/confix/go.sum +++ b/tools/confix/go.sum @@ -645,8 +645,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= diff --git a/tools/cosmovisor/README.md b/tools/cosmovisor/README.md index 54b03cc26b31..b7b7977433f2 100644 --- a/tools/cosmovisor/README.md +++ b/tools/cosmovisor/README.md @@ -35,7 +35,7 @@ Cosmovisor is designed to be used as a wrapper for a `Cosmos SDK` app: *Note: If new versions of the application are not set up to run in-place store migrations, migrations will need to be run manually before restarting `cosmovisor` with the new binary. For this reason, we recommend applications adopt in-place store migrations.* :::tip -Only the lastest version of cosmovisor is actively developed/maintained. +Only the latest version of cosmovisor is actively developed/maintained. ::: :::warning @@ -128,9 +128,9 @@ Use of `cosmovisor` without one of the action arguments is deprecated. For backw └── preupgrade.sh (optional) ``` -The `cosmovisor/` directory incudes a subdirectory for each version of the application (i.e. `genesis` or `upgrades/`). Within each subdirectory is the application binary (i.e. `bin/$DAEMON_NAME`) and any additional auxiliary files associated with each binary. `current` is a symbolic link to the currently active directory (i.e. `genesis` or `upgrades/`). The `name` variable in `upgrades/` is the lowercased URI-encoded name of the upgrade as specified in the upgrade module plan. Note that the upgrade name path are normalized to be lowercased: for instance, `MyUpgrade` is normalized to `myupgrade`, and its path is `upgrades/myupgrade`. +The `cosmovisor/` directory includes a subdirectory for each version of the application (i.e. `genesis` or `upgrades/`). Within each subdirectory is the application binary (i.e. `bin/$DAEMON_NAME`) and any additional auxiliary files associated with each binary. `current` is a symbolic link to the currently active directory (i.e. `genesis` or `upgrades/`). The `name` variable in `upgrades/` is the lowercased URI-encoded name of the upgrade as specified in the upgrade module plan. Note that the upgrade name path are normalized to be lowercased: for instance, `MyUpgrade` is normalized to `myupgrade`, and its path is `upgrades/myupgrade`. -Please note that `$DAEMON_HOME/cosmovisor` only stores the *application binaries*. The `cosmovisor` binary itself can be stored in any typical location (e.g. `/usr/local/bin`). The application will continue to store its data in the default data directory (e.g. `$HOME/.simapp`) or the data directory specified with the `--home` flag. `$DAEMON_HOME` is independent of the data directory and can be set to any location. If you set `$DAEMON_HOME` to the same directory as the data directory, you will end up with a configuation like the following: +Please note that `$DAEMON_HOME/cosmovisor` only stores the *application binaries*. The `cosmovisor` binary itself can be stored in any typical location (e.g. `/usr/local/bin`). The application will continue to store its data in the default data directory (e.g. `$HOME/.simapp`) or the data directory specified with the `--home` flag. `$DAEMON_HOME` is independent of the data directory and can be set to any location. If you set `$DAEMON_HOME` to the same directory as the data directory, you will end up with a configuration like the following: ```text .simapp diff --git a/tools/cosmovisor/go.mod b/tools/cosmovisor/go.mod index 5ca328d78f9d..79e441a1a160 100644 --- a/tools/cosmovisor/go.mod +++ b/tools/cosmovisor/go.mod @@ -122,7 +122,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect diff --git a/tools/cosmovisor/go.sum b/tools/cosmovisor/go.sum index 0c7ce4925413..bc4937af0c3a 100644 --- a/tools/cosmovisor/go.sum +++ b/tools/cosmovisor/go.sum @@ -832,8 +832,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= diff --git a/tools/cosmovisor/process.go b/tools/cosmovisor/process.go index c41731e04b33..3de7a942faec 100644 --- a/tools/cosmovisor/process.go +++ b/tools/cosmovisor/process.go @@ -180,8 +180,8 @@ func (l Launcher) doBackup() error { // a destination directory, Format YYYY-MM-DD st := time.Now() - stStr := fmt.Sprintf("%d-%d-%d", st.Year(), st.Month(), st.Day()) - dst := filepath.Join(l.cfg.DataBackupPath, fmt.Sprintf("data"+"-backup-%s", stStr)) + ymd := fmt.Sprintf("%d-%d-%d", st.Year(), st.Month(), st.Day()) + dst := filepath.Join(l.cfg.DataBackupPath, fmt.Sprintf("data"+"-backup-%s", ymd)) l.logger.Info("starting to take backup of data directory", "backup start time", st) diff --git a/tools/cosmovisor/scanner.go b/tools/cosmovisor/scanner.go index af8774949d2b..d601e3aee89a 100644 --- a/tools/cosmovisor/scanner.go +++ b/tools/cosmovisor/scanner.go @@ -131,7 +131,7 @@ func (fw *fileWatcher) CheckUpdate(currentUpgrade upgradetypes.Plan) bool { fw.currentInfo = info fw.lastModTime = stat.ModTime() - // Heuristic: Deamon has restarted, so we don't know if we successfully + // Heuristic: Daemon has restarted, so we don't know if we successfully // downloaded the upgrade or not. So we try to compare the running upgrade // name (read from the cosmovisor file) with the upgrade info. if !strings.EqualFold(currentUpgrade.Name, fw.currentInfo.Name) { diff --git a/tools/hubl/go.mod b/tools/hubl/go.mod index 76935fabf6ea..974890416192 100644 --- a/tools/hubl/go.mod +++ b/tools/hubl/go.mod @@ -10,7 +10,7 @@ require ( github.com/cockroachdb/errors v1.11.1 github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20231020102946-7421783eda5d github.com/manifoldco/promptui v0.9.0 - github.com/pelletier/go-toml/v2 v2.1.0 + github.com/pelletier/go-toml/v2 v2.1.1 github.com/spf13/cobra v1.8.0 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 diff --git a/tools/hubl/go.sum b/tools/hubl/go.sum index 3116ae2e547b..49b523650711 100644 --- a/tools/hubl/go.sum +++ b/tools/hubl/go.sum @@ -645,8 +645,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= diff --git a/types/address.go b/types/address.go index e3ac48e31a65..fce62a681564 100644 --- a/types/address.go +++ b/types/address.go @@ -629,7 +629,7 @@ func (ca ConsAddress) String() string { } // Bech32ifyAddressBytes returns a bech32 representation of address bytes. -// Returns an empty sting if the byte slice is 0-length. Returns an error if the bech32 conversion +// Returns an empty string if the byte slice is 0-length. Returns an error if the bech32 conversion // fails or the prefix is empty. func Bech32ifyAddressBytes(prefix string, bs []byte) (string, error) { if len(bs) == 0 { @@ -642,7 +642,7 @@ func Bech32ifyAddressBytes(prefix string, bs []byte) (string, error) { } // MustBech32ifyAddressBytes returns a bech32 representation of address bytes. -// Returns an empty sting if the byte slice is 0-length. It panics if the bech32 conversion +// Returns an empty string if the byte slice is 0-length. It panics if the bech32 conversion // fails or the prefix is empty. func MustBech32ifyAddressBytes(prefix string, bs []byte) string { s, err := Bech32ifyAddressBytes(prefix, bs) diff --git a/types/address_race_test.go b/types/address_race_test.go index 5d363fda1381..f4cbb296405d 100644 --- a/types/address_race_test.go +++ b/types/address_race_test.go @@ -40,11 +40,11 @@ func (s *addressTestSuite) TestAddressRace() { done := make(chan bool, workers) cancel := make(chan bool) - for i := byte(1); i <= 2; i++ { // workes which will loop in first 100 addresses + for i := byte(1); i <= 2; i++ { // works which will loop in first 100 addresses go addressStringCaller(s.Require(), i, 100, cancel, done) } - for i := byte(1); i <= 2; i++ { // workes which will generate 1e6 new addresses + for i := byte(1); i <= 2; i++ { // works which will generate 1e6 new addresses go addressStringCaller(s.Require(), i, 1000000, cancel, done) } diff --git a/types/coin_test.go b/types/coin_test.go index bce1eb8bd84e..d1136a4a5046 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -76,7 +76,7 @@ func (s *coinTestSuite) TestIsEqualCoin() { func (s *coinTestSuite) TestCoinIsValid() { loremIpsum := `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam viverra dui vel nulla aliquet, non dictum elit aliquam. Proin consequat leo in consectetur mattis. Phasellus eget odio luctus, rutrum dolor at, venenatis ante. Praesent metus erat, sodales vitae sagittis eget, commodo non ipsum. Duis eget urna quis erat mattis pulvinar. Vivamus egestas imperdiet sem, porttitor hendrerit lorem pulvinar in. Vivamus laoreet sapien eget libero euismod tristique. Suspendisse tincidunt nulla quis luctus mattis. - Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed id turpis at erat placerat fermentum id sed sapien. Fusce mattis enim id nulla viverra, eget placerat eros aliquet. Nunc fringilla urna ac condimentum ultricies. Praesent in eros ac neque fringilla sodales. Donec ut venenatis eros. Quisque iaculis lectus neque, a varius sem ullamcorper nec. Cras tincidunt dignissim libero nec volutpat. Donec molestie enim sed metus venenatis, quis elementum sem varius. Curabitur eu venenatis nulla. + Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed id turpis at erat placerat fermentum id sed sapien. Fusce mattis enim id nulla viverra, eget placerat eros aliquet. Nunc fringilla urna ac condimentum ultricies. Praesent in eros ac neque fringilla sodales. Donec ut venenatis eros. Quisque iaculis lectus neque, a various sem ullamcorper nec. Cras tincidunt dignissim libero nec volutpat. Donec molestie enim sed metus venenatis, quis elementum sem various. Curabitur eu venenatis nulla. Cras sit amet ligula vel turpis placerat sollicitudin. Nunc massa odio, eleifend id lacus nec, ultricies elementum arcu. Donec imperdiet nulla lacus, a venenatis lacus fermentum nec. Proin vestibulum dolor enim, vitae posuere velit aliquet non. Suspendisse pharetra condimentum nunc tincidunt viverra. Etiam posuere, ligula ut maximus congue, mauris orci consectetur velit, vel finibus eros metus non tellus. Nullam et dictum metus. Aliquam maximus fermentum mauris elementum aliquet. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam dapibus lectus sed tellus rutrum tincidunt. Nulla at dolor sem. Ut non dictum arcu, eget congue sem.` loremIpsum = strings.ReplaceAll(loremIpsum, " ", "") diff --git a/types/mempool/priority_nonce_spec.md b/types/mempool/priority_nonce_spec.md index cc24fa1daeb8..ae271e5d6237 100644 --- a/types/mempool/priority_nonce_spec.md +++ b/types/mempool/priority_nonce_spec.md @@ -143,4 +143,4 @@ graph TD Mempool order: [10, 15, 30, 8, 20, 6, 4, 2, 90] -This case shows how the mempool handles a more complex graph with more priority edges between senders. Again we also demonstrate an idiosyncrasy of this nonce/priroity ordering scheme, tx(priority=90) is selected last because it is gated behind tx(priority=2) by nonce ordering. +This case shows how the mempool handles a more complex graph with more priority edges between senders. Again we also demonstrate an idiosyncrasy of this nonce/priority ordering scheme, tx(priority=90) is selected last because it is gated behind tx(priority=2) by nonce ordering. diff --git a/types/module/module.go b/types/module/module.go index c83913ae04dc..9fd7bc1c7750 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -643,7 +643,7 @@ type MigrationHandler func(sdk.Context) error type VersionMap map[string]uint64 // RunMigrations performs in-place store migrations for all modules. This -// function MUST be called insde an x/upgrade UpgradeHandler. +// function MUST be called inside an x/upgrade UpgradeHandler. // // Recall that in an upgrade handler, the `fromVM` VersionMap is retrieved from // x/upgrade's store, and the function needs to return the target VersionMap diff --git a/types/router.go b/types/router.go index ef644994629c..b4a58d8fe09f 100644 --- a/types/router.go +++ b/types/router.go @@ -4,6 +4,6 @@ import ( "regexp" ) -// IsAlphaNumeric defines a regular expression for matching against alpha-numeric +// IsAlphaNumeric defines a regular expression for matching against alphanumeric // values. var IsAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString diff --git a/types/tx/signing/signature.go b/types/tx/signing/signature.go index c5faf4b8d1d4..a9549bab9a12 100644 --- a/types/tx/signing/signature.go +++ b/types/tx/signing/signature.go @@ -71,15 +71,15 @@ func SignatureDataFromProto(descData *SignatureDescriptor_Data) SignatureData { } case *SignatureDescriptor_Data_Multi_: multi := descData.Multi - datas := make([]SignatureData, len(multi.Signatures)) + data := make([]SignatureData, len(multi.Signatures)) for j, d := range multi.Signatures { - datas[j] = SignatureDataFromProto(d) + data[j] = SignatureDataFromProto(d) } return &MultiSignatureData{ BitArray: multi.Bitarray, - Signatures: datas, + Signatures: data, } default: panic(fmt.Errorf("unexpected case %+v", descData)) diff --git a/x/accounts/account_test.go b/x/accounts/account_test.go index a984c14e6b39..6d6834b90fa7 100644 --- a/x/accounts/account_test.go +++ b/x/accounts/account_test.go @@ -4,8 +4,7 @@ import ( "context" "strconv" - "google.golang.org/protobuf/types/known/emptypb" - "google.golang.org/protobuf/types/known/wrapperspb" + "github.com/cosmos/gogoproto/types" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" @@ -27,32 +26,32 @@ type TestAccount struct { } func (t TestAccount) RegisterInitHandler(builder *implementation.InitBuilder) { - implementation.RegisterInitHandler(builder, func(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { + implementation.RegisterInitHandler(builder, func(ctx context.Context, _ *types.Empty) (*types.Empty, error) { // we also force a module call here to test things work as expected. _, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{ Address: string(implementation.Whoami(ctx)), Denom: "atom", }) - return &emptypb.Empty{}, err + return &types.Empty{}, err }) } func (t TestAccount) RegisterExecuteHandlers(builder *implementation.ExecuteBuilder) { - implementation.RegisterExecuteHandler(builder, func(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { - return &emptypb.Empty{}, nil + implementation.RegisterExecuteHandler(builder, func(_ context.Context, _ *types.Empty) (*types.Empty, error) { + return &types.Empty{}, nil }) - implementation.RegisterExecuteHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.UInt64Value, error) { + implementation.RegisterExecuteHandler(builder, func(_ context.Context, req *types.StringValue) (*types.UInt64Value, error) { value, err := strconv.ParseUint(req.Value, 10, 64) if err != nil { return nil, err } - return wrapperspb.UInt64(value), nil + return &types.UInt64Value{Value: value}, nil }) // this is for intermodule comms testing, we simulate a bank send - implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *wrapperspb.Int64Value) (*emptypb.Empty, error) { + implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *types.Int64Value) (*types.Empty, error) { resp, err := implementation.ExecModule[bankv1beta1.MsgSendResponse](ctx, &bankv1beta1.MsgSend{ FromAddress: string(implementation.Whoami(ctx)), ToAddress: "recipient", @@ -70,27 +69,27 @@ func (t TestAccount) RegisterExecuteHandlers(builder *implementation.ExecuteBuil panic("nil response") // should never happen } - return &emptypb.Empty{}, nil + return &types.Empty{}, nil }) // genesis testing - implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *wrapperspb.UInt64Value) (*emptypb.Empty, error) { - return new(emptypb.Empty), t.Counter.Set(ctx, req.Value) + implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *types.UInt64Value) (*types.Empty, error) { + return &types.Empty{}, t.Counter.Set(ctx, req.Value) }) } func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder) { - implementation.RegisterQueryHandler(builder, func(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { - return &emptypb.Empty{}, nil + implementation.RegisterQueryHandler(builder, func(_ context.Context, _ *types.Empty) (*types.Empty, error) { + return &types.Empty{}, nil }) - implementation.RegisterQueryHandler(builder, func(_ context.Context, req *wrapperspb.UInt64Value) (*wrapperspb.StringValue, error) { - return wrapperspb.String(strconv.FormatUint(req.Value, 10)), nil + implementation.RegisterQueryHandler(builder, func(_ context.Context, req *types.UInt64Value) (*types.StringValue, error) { + return &types.StringValue{Value: strconv.FormatUint(req.Value, 10)}, nil }) // test intermodule comms, we simulate someone is sending the account a request for the accounts balance // of a given denom. - implementation.RegisterQueryHandler(builder, func(ctx context.Context, req *wrapperspb.StringValue) (*wrapperspb.Int64Value, error) { + implementation.RegisterQueryHandler(builder, func(ctx context.Context, req *types.StringValue) (*types.Int64Value, error) { resp, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{ Address: string(implementation.Whoami(ctx)), Denom: req.Value, @@ -103,16 +102,16 @@ func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder) if err != nil { return nil, err } - return wrapperspb.Int64(amt), nil + return &types.Int64Value{Value: amt}, nil }) // genesis testing; DoubleValue does not make sense as a request type for this query, but empty is already taken // and this is only used for testing. - implementation.RegisterQueryHandler(builder, func(ctx context.Context, _ *wrapperspb.DoubleValue) (*wrapperspb.UInt64Value, error) { + implementation.RegisterQueryHandler(builder, func(ctx context.Context, _ *types.DoubleValue) (*types.UInt64Value, error) { v, err := t.Counter.Peek(ctx) if err != nil { return nil, err } - return &wrapperspb.UInt64Value{Value: v}, nil + return &types.UInt64Value{Value: v}, nil }) } diff --git a/x/accounts/accountstd/exports.go b/x/accounts/accountstd/exports.go index f05191bf8ed5..c29272e6d65a 100644 --- a/x/accounts/accountstd/exports.go +++ b/x/accounts/accountstd/exports.go @@ -6,9 +6,6 @@ import ( "context" "fmt" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" - "cosmossdk.io/x/accounts/internal/implementation" "github.com/cosmos/cosmos-sdk/types/address" @@ -35,7 +32,7 @@ type AccountCreatorFunc = implementation.AccountCreatorFunc type Dependencies = implementation.Dependencies func RegisterExecuteHandler[ - Req any, ProtoReq implementation.ProtoMsg[Req], Resp any, ProtoResp implementation.ProtoMsg[Resp], + Req any, ProtoReq implementation.ProtoMsgG[Req], Resp any, ProtoResp implementation.ProtoMsgG[Resp], ](router *ExecuteBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), ) { implementation.RegisterExecuteHandler(router, handler) @@ -43,7 +40,7 @@ func RegisterExecuteHandler[ // RegisterQueryHandler registers a query handler for a smart account that uses protobuf. func RegisterQueryHandler[ - Req any, ProtoReq implementation.ProtoMsg[Req], Resp any, ProtoResp implementation.ProtoMsg[Resp], + Req any, ProtoReq implementation.ProtoMsgG[Req], Resp any, ProtoResp implementation.ProtoMsgG[Resp], ](router *QueryBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), ) { implementation.RegisterQueryHandler(router, handler) @@ -51,7 +48,7 @@ func RegisterQueryHandler[ // RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf. func RegisterInitHandler[ - Req any, ProtoReq implementation.ProtoMsg[Req], Resp any, ProtoResp implementation.ProtoMsg[Resp], + Req any, ProtoReq implementation.ProtoMsgG[Req], Resp any, ProtoResp implementation.ProtoMsgG[Resp], ](router *InitBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), ) { implementation.RegisterInitHandler(router, handler) @@ -59,7 +56,10 @@ func RegisterInitHandler[ // AddAccount is a helper function to add a smart account to the list of smart accounts. func AddAccount[A Interface](name string, constructor func(deps Dependencies) (A, error)) AccountCreatorFunc { - return implementation.AddAccount(name, constructor) + return func(deps implementation.Dependencies) (string, implementation.Account, error) { + acc, err := constructor(deps) + return name, acc, err + } } // Whoami returns the address of the account being invoked. @@ -78,34 +78,34 @@ func SenderIsAccountsModule(ctx context.Context) bool { } // ExecModule can be used to execute a message towards a module. -func ExecModule[Resp any, RespProto implementation.ProtoMsg[Resp], Req any, ReqProto implementation.ProtoMsg[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { +func ExecModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { return implementation.ExecModule[Resp, RespProto, Req, ReqProto](ctx, msg) } -func ExecModuleUntyped(ctx context.Context, msg proto.Message) (proto.Message, error) { +func ExecModuleUntyped(ctx context.Context, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { return implementation.ExecModuleUntyped(ctx, msg) } // QueryModule can be used by an account to execute a module query. -func QueryModule[Resp any, RespProto implementation.ProtoMsg[Resp], Req any, ReqProto implementation.ProtoMsg[Req]](ctx context.Context, req ReqProto) (RespProto, error) { +func QueryModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) { return implementation.QueryModule[Resp, RespProto, Req, ReqProto](ctx, req) } // UnpackAny unpacks a protobuf Any message generically. -func UnpackAny[Msg any, ProtoMsg implementation.ProtoMsg[Msg]](any *anypb.Any) (*Msg, error) { +func UnpackAny[Msg any, ProtoMsg implementation.ProtoMsgG[Msg]](any *implementation.Any) (*Msg, error) { return implementation.UnpackAny[Msg, ProtoMsg](any) } // PackAny packs a protobuf Any message generically. -func PackAny(msg proto.Message) (*anypb.Any, error) { +func PackAny(msg implementation.ProtoMsg) (*implementation.Any, error) { return implementation.PackAny(msg) } // ExecModuleAnys can be used to execute a list of messages towards a module // when those messages are packed in Any messages. The function returns a list // of responses packed in Any messages. -func ExecModuleAnys(ctx context.Context, msgs []*anypb.Any) ([]*anypb.Any, error) { - responses := make([]*anypb.Any, len(msgs)) +func ExecModuleAnys(ctx context.Context, msgs []*implementation.Any) ([]*implementation.Any, error) { + responses := make([]*implementation.Any, len(msgs)) for i, msg := range msgs { concreteMessage, err := implementation.UnpackAnyRaw(msg) if err != nil { diff --git a/x/accounts/cli/cli.go b/x/accounts/cli/cli.go index 7e40ec7af5e6..ed7de6d51618 100644 --- a/x/accounts/cli/cli.go +++ b/x/accounts/cli/cli.go @@ -1,20 +1,20 @@ package cli import ( + "bytes" "fmt" + "reflect" + "github.com/cosmos/gogoproto/jsonpb" + gogoproto "github.com/cosmos/gogoproto/proto" "github.com/spf13/cobra" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/types/known/anypb" v1 "cosmossdk.io/x/accounts/v1" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" ) func TxCmd(name string) *cobra.Command { @@ -140,12 +140,7 @@ func GetQueryAccountCmd() *cobra.Command { if err != nil { return err } - jsonResp, err := handlerResponseJSONBytes(schema.QueryHandlers, args[1], res.Response) - if err != nil { - return err - } - - return clientCtx.PrintString(jsonResp) + return clientCtx.PrintProto(res) }, } flags.AddQueryFlagsToCmd(cmd) @@ -165,7 +160,7 @@ func getSchemaForAccount(clientCtx client.Context, addr string) (*v1.SchemaRespo }) } -func handlerMsgBytes(handlersSchema []*v1.SchemaResponse_Handler, msgTypeURL, msgString string) ([]byte, error) { +func handlerMsgBytes(handlersSchema []*v1.SchemaResponse_Handler, msgTypeURL, msgString string) (*codectypes.Any, error) { var msgSchema *v1.SchemaResponse_Handler for _, handler := range handlersSchema { if handler.Request == msgTypeURL { @@ -176,64 +171,18 @@ func handlerMsgBytes(handlersSchema []*v1.SchemaResponse_Handler, msgTypeURL, ms if msgSchema == nil { return nil, fmt.Errorf("handler for message type %s not found", msgTypeURL) } - msgBytes, err := encodeJSONToProto(msgSchema.Request, msgString) - if err != nil { - return nil, err - } - return proto.MarshalOptions{Deterministic: true}.Marshal(&anypb.Any{ - TypeUrl: "/" + msgTypeURL, - Value: msgBytes, - }) + return encodeJSONToProto(msgSchema.Request, msgString) } -func handlerResponseJSONBytes(handlerSchema []*v1.SchemaResponse_Handler, msgTypeURL string, protoBytes []byte) (string, error) { - var msgSchema *v1.SchemaResponse_Handler - for _, handler := range handlerSchema { - if handler.Request == msgTypeURL { - msgSchema = handler - break - } - } - if msgSchema == nil { - return "", fmt.Errorf("handler for message type %s not found", msgTypeURL) - } - anyMsg := new(anypb.Any) - err := proto.Unmarshal(protoBytes, anyMsg) - if err != nil { - return "", err - } - return decodeProtoToJSON(msgSchema.Response, anyMsg.Value) -} - -func encodeJSONToProto(name, jsonMsg string) ([]byte, error) { - jsonBytes := []byte(jsonMsg) - impl, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(name)) - if err != nil { - return nil, err - } - msg := impl.New().Interface() - err = protojson.Unmarshal(jsonBytes, msg) - if err != nil { - return nil, err - } - return proto.Marshal(msg) -} - -func decodeProtoToJSON(name string, protoBytes []byte) (string, error) { - impl, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(name)) - if err != nil { - return "", err - } - msg := impl.New().Interface() - err = proto.UnmarshalOptions{}.Unmarshal(protoBytes, msg) - if err != nil { - return "", fmt.Errorf( - "%w: unable to unmarshal protobytes in message '%s', message name: %s", - err, protoBytes, name) +func encodeJSONToProto(name, jsonMsg string) (*codectypes.Any, error) { + impl := gogoproto.MessageType(name) + if impl == nil { + return nil, fmt.Errorf("message type %s not found", name) } - jsonBytes, err := protojson.Marshal(msg) + msg := reflect.New(impl.Elem()).Interface().(gogoproto.Message) + err := jsonpb.Unmarshal(bytes.NewBufferString(jsonMsg), msg) if err != nil { - return "", err + return nil, fmt.Errorf("provided message is not valid %s: %w", jsonMsg, err) } - return string(jsonBytes), nil + return codectypes.NewAnyWithValue(msg) } diff --git a/x/accounts/genesis.go b/x/accounts/genesis.go index 24ce7fbbea18..a760344ab052 100644 --- a/x/accounts/genesis.go +++ b/x/accounts/genesis.go @@ -19,8 +19,12 @@ func (k Keeper) ExportState(ctx context.Context) (*v1.GenesisState, error) { genState.AccountNumber = accountNumber - err = k.AccountsByType.Walk(ctx, nil, func(key []byte, value string) (stop bool, err error) { - accState, err := k.exportAccount(ctx, key, value) + err = k.AccountsByType.Walk(ctx, nil, func(accAddr []byte, accType string) (stop bool, err error) { + accNum, err := k.AccountByNumber.Get(ctx, accAddr) + if err != nil { + return true, err + } + accState, err := k.exportAccount(ctx, accAddr, accType, accNum) if err != nil { return true, err } @@ -34,20 +38,21 @@ func (k Keeper) ExportState(ctx context.Context) (*v1.GenesisState, error) { return genState, nil } -func (k Keeper) exportAccount(ctx context.Context, addr []byte, accType string) (*v1.GenesisAccount, error) { +func (k Keeper) exportAccount(ctx context.Context, addr []byte, accType string, accNum uint64) (*v1.GenesisAccount, error) { addrString, err := k.addressCodec.BytesToString(addr) if err != nil { return nil, err } account := &v1.GenesisAccount{ - Address: addrString, - AccountType: accType, + Address: addrString, + AccountType: accType, + AccountNumber: accNum, + State: nil, } - rng := new(collections.Range[[]byte]). - Prefix(addr) - err = k.AccountsState.Walk(ctx, rng, func(key, value []byte) (stop bool, err error) { + rng := collections.NewPrefixedPairRange[uint64, []byte](accNum) + err = k.AccountsState.Walk(ctx, rng, func(key collections.Pair[uint64, []byte], value []byte) (stop bool, err error) { account.State = append(account.State, &v1.KVPair{ - Key: key, + Key: key.K2(), Value: value, }) return false, nil @@ -84,8 +89,12 @@ func (k Keeper) importAccount(ctx context.Context, acc *v1.GenesisAccount) error if err != nil { return err } + err = k.AccountByNumber.Set(ctx, addrBytes, acc.AccountNumber) + if err != nil { + return err + } for _, kv := range acc.State { - err = k.AccountsState.Set(ctx, kv.Key, kv.Value) + err = k.AccountsState.Set(ctx, collections.Join(acc.AccountNumber, kv.Key), kv.Value) if err != nil { return err } diff --git a/x/accounts/genesis_test.go b/x/accounts/genesis_test.go index 1edafbf5a833..561c14694f50 100644 --- a/x/accounts/genesis_test.go +++ b/x/accounts/genesis_test.go @@ -4,30 +4,31 @@ import ( "context" "testing" + "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/emptypb" - "google.golang.org/protobuf/types/known/wrapperspb" "cosmossdk.io/collections/colltest" "cosmossdk.io/x/accounts/internal/implementation" ) func TestGenesis(t *testing.T) { - k, ctx := newKeeper(t, implementation.AddAccount("test", NewTestAccount)) - k.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { return nil }) + k, ctx := newKeeper(t, func(deps implementation.Dependencies) (string, implementation.Account, error) { + acc, err := NewTestAccount(deps) + return "test", acc, err + }) + k.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { return nil }) // we init two accounts of the same type // we set counter to 10 - _, addr1, err := k.Init(ctx, "test", []byte("sender"), &emptypb.Empty{}) + _, addr1, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}) require.NoError(t, err) - _, err = k.Execute(ctx, addr1, []byte("sender"), &wrapperspb.UInt64Value{Value: 10}) + _, err = k.Execute(ctx, addr1, []byte("sender"), &types.UInt64Value{Value: 10}) require.NoError(t, err) // we set counter to 20 - _, addr2, err := k.Init(ctx, "test", []byte("sender"), &emptypb.Empty{}) + _, addr2, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{}) require.NoError(t, err) - _, err = k.Execute(ctx, addr2, []byte("sender"), &wrapperspb.UInt64Value{Value: 20}) + _, err = k.Execute(ctx, addr2, []byte("sender"), &types.UInt64Value{Value: 20}) require.NoError(t, err) // export state @@ -41,11 +42,11 @@ func TestGenesis(t *testing.T) { // if genesis import went fine, we should be able to query the accounts // and get the expected values. - resp, err := k.Query(ctx, addr1, &wrapperspb.DoubleValue{}) + resp, err := k.Query(ctx, addr1, &types.DoubleValue{}) require.NoError(t, err) - require.Equal(t, &wrapperspb.UInt64Value{Value: 10}, resp) + require.Equal(t, &types.UInt64Value{Value: 10}, resp) - resp, err = k.Query(ctx, addr2, &wrapperspb.DoubleValue{}) + resp, err = k.Query(ctx, addr2, &types.DoubleValue{}) require.NoError(t, err) - require.Equal(t, &wrapperspb.UInt64Value{Value: 20}, resp) + require.Equal(t, &types.UInt64Value{Value: 20}, resp) } diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 7a4024d640c7..bd3ce5bbab5e 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -27,7 +27,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -106,7 +108,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -132,14 +134,18 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 7e5203e7824a..ae9f35909ace 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -61,9 +61,13 @@ github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwR 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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/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= @@ -604,8 +608,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -763,6 +767,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= @@ -840,6 +848,8 @@ 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.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.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= @@ -1063,6 +1073,8 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f 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.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= 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= diff --git a/x/accounts/interfaces/account_abstraction/v1/interface.pb.go b/x/accounts/interfaces/account_abstraction/v1/interface.pb.go new file mode 100644 index 000000000000..ee4fb356ee69 --- /dev/null +++ b/x/accounts/interfaces/account_abstraction/v1/interface.pb.go @@ -0,0 +1,1671 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/accounts/interfaces/account_abstraction/v1/interface.proto + +package v1 + +import ( + v1 "cosmossdk.io/x/accounts/v1" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgAuthenticate is a message that an x/account account abstraction implementer +// must handle to authenticate a state transition. +type MsgAuthenticate struct { + // bundler defines the address of the bundler that sent the operation. + // NOTE: in case the operation was sent directly by the user, this field will reflect + // the user address. + Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"` + // user_operation is the operation that the user is trying to perform. + // it also contains authentication information. + UserOperation *v1.UserOperation `protobuf:"bytes,2,opt,name=user_operation,json=userOperation,proto3" json:"user_operation,omitempty"` +} + +func (m *MsgAuthenticate) Reset() { *m = MsgAuthenticate{} } +func (m *MsgAuthenticate) String() string { return proto.CompactTextString(m) } +func (*MsgAuthenticate) ProtoMessage() {} +func (*MsgAuthenticate) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{0} +} +func (m *MsgAuthenticate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAuthenticate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAuthenticate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAuthenticate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAuthenticate.Merge(m, src) +} +func (m *MsgAuthenticate) XXX_Size() int { + return m.Size() +} +func (m *MsgAuthenticate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAuthenticate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAuthenticate proto.InternalMessageInfo + +func (m *MsgAuthenticate) GetBundler() string { + if m != nil { + return m.Bundler + } + return "" +} + +func (m *MsgAuthenticate) GetUserOperation() *v1.UserOperation { + if m != nil { + return m.UserOperation + } + return nil +} + +// MsgAuthenticateResponse is the response to MsgAuthenticate. +// The authentication either fails or succeeds, this is why +// there are no auxiliary fields to the response. +type MsgAuthenticateResponse struct { +} + +func (m *MsgAuthenticateResponse) Reset() { *m = MsgAuthenticateResponse{} } +func (m *MsgAuthenticateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAuthenticateResponse) ProtoMessage() {} +func (*MsgAuthenticateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{1} +} +func (m *MsgAuthenticateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAuthenticateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAuthenticateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAuthenticateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAuthenticateResponse.Merge(m, src) +} +func (m *MsgAuthenticateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAuthenticateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAuthenticateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAuthenticateResponse proto.InternalMessageInfo + +// MsgPayBundler is a message that an x/account account abstraction implementer +// can optionally implement in case it wants to further refine control over +// the bundler payment messages. +// The account must ensure the caller of this message is the x/accounts module itself. +type MsgPayBundler struct { + // bundler is the address of the bundler. + // NOTE: in case the operation was sent directly by the user, this field will + // reflect the user address. + Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"` + // bundler_payment_messages are the messages that the operation sender will execute. + // The account can modify the messages as it sees fit. + BundlerPaymentMessages []*types.Any `protobuf:"bytes,2,rep,name=bundler_payment_messages,json=bundlerPaymentMessages,proto3" json:"bundler_payment_messages,omitempty"` +} + +func (m *MsgPayBundler) Reset() { *m = MsgPayBundler{} } +func (m *MsgPayBundler) String() string { return proto.CompactTextString(m) } +func (*MsgPayBundler) ProtoMessage() {} +func (*MsgPayBundler) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{2} +} +func (m *MsgPayBundler) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPayBundler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPayBundler.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgPayBundler) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPayBundler.Merge(m, src) +} +func (m *MsgPayBundler) XXX_Size() int { + return m.Size() +} +func (m *MsgPayBundler) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPayBundler.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPayBundler proto.InternalMessageInfo + +func (m *MsgPayBundler) GetBundler() string { + if m != nil { + return m.Bundler + } + return "" +} + +func (m *MsgPayBundler) GetBundlerPaymentMessages() []*types.Any { + if m != nil { + return m.BundlerPaymentMessages + } + return nil +} + +// MsgPayBundlerResponse is the response to MsgPayBundler. +type MsgPayBundlerResponse struct { + // bundler_payment_messages_response are the messages that the bundler will pay for. + BundlerPaymentMessagesResponse []*types.Any `protobuf:"bytes,1,rep,name=bundler_payment_messages_response,json=bundlerPaymentMessagesResponse,proto3" json:"bundler_payment_messages_response,omitempty"` +} + +func (m *MsgPayBundlerResponse) Reset() { *m = MsgPayBundlerResponse{} } +func (m *MsgPayBundlerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPayBundlerResponse) ProtoMessage() {} +func (*MsgPayBundlerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{3} +} +func (m *MsgPayBundlerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPayBundlerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPayBundlerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgPayBundlerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPayBundlerResponse.Merge(m, src) +} +func (m *MsgPayBundlerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPayBundlerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPayBundlerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPayBundlerResponse proto.InternalMessageInfo + +func (m *MsgPayBundlerResponse) GetBundlerPaymentMessagesResponse() []*types.Any { + if m != nil { + return m.BundlerPaymentMessagesResponse + } + return nil +} + +// MsgExecute is a message that an x/account account abstraction implementer +// can optionally implement in case it wants to further refine control over +// the execution messages. It can be used to extend the execution flow, possibly +// block certain messages, or modify them. +// The account must ensure the caller of this message is the x/accounts module itself. +type MsgExecute struct { + // bundler is the address of the bundler. + // NOTE: in case the operation was sent directly by the user, this field will + // reflect the user address. + Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"` + // execution_messages are the messages that the operation sender will execute. + // The account can modify the messages as it sees fit. + ExecutionMessages []*types.Any `protobuf:"bytes,2,rep,name=execution_messages,json=executionMessages,proto3" json:"execution_messages,omitempty"` +} + +func (m *MsgExecute) Reset() { *m = MsgExecute{} } +func (m *MsgExecute) String() string { return proto.CompactTextString(m) } +func (*MsgExecute) ProtoMessage() {} +func (*MsgExecute) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{4} +} +func (m *MsgExecute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecute.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgExecute) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecute.Merge(m, src) +} +func (m *MsgExecute) XXX_Size() int { + return m.Size() +} +func (m *MsgExecute) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecute.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecute proto.InternalMessageInfo + +func (m *MsgExecute) GetBundler() string { + if m != nil { + return m.Bundler + } + return "" +} + +func (m *MsgExecute) GetExecutionMessages() []*types.Any { + if m != nil { + return m.ExecutionMessages + } + return nil +} + +// MsgExecuteResponse is the response to MsgExecute. +type MsgExecuteResponse struct { + // execution_messages_response are the messages that the operation sender will execute. + ExecutionMessagesResponse []*types.Any `protobuf:"bytes,1,rep,name=execution_messages_response,json=executionMessagesResponse,proto3" json:"execution_messages_response,omitempty"` +} + +func (m *MsgExecuteResponse) Reset() { *m = MsgExecuteResponse{} } +func (m *MsgExecuteResponse) String() string { return proto.CompactTextString(m) } +func (*MsgExecuteResponse) ProtoMessage() {} +func (*MsgExecuteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{5} +} +func (m *MsgExecuteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecuteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecuteResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgExecuteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecuteResponse.Merge(m, src) +} +func (m *MsgExecuteResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgExecuteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecuteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecuteResponse proto.InternalMessageInfo + +func (m *MsgExecuteResponse) GetExecutionMessagesResponse() []*types.Any { + if m != nil { + return m.ExecutionMessagesResponse + } + return nil +} + +// QueryAuthenticationMethods is a query that an x/account account abstraction implementer +// must handle to return the authentication methods that the account supports. +type QueryAuthenticationMethods struct { +} + +func (m *QueryAuthenticationMethods) Reset() { *m = QueryAuthenticationMethods{} } +func (m *QueryAuthenticationMethods) String() string { return proto.CompactTextString(m) } +func (*QueryAuthenticationMethods) ProtoMessage() {} +func (*QueryAuthenticationMethods) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{6} +} +func (m *QueryAuthenticationMethods) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthenticationMethods) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthenticationMethods.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAuthenticationMethods) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthenticationMethods.Merge(m, src) +} +func (m *QueryAuthenticationMethods) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthenticationMethods) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthenticationMethods.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthenticationMethods proto.InternalMessageInfo + +// QueryAuthenticationMethodsResponse is the response to QueryAuthenticationMethods. +type QueryAuthenticationMethodsResponse struct { + // authentication_methods are the authentication methods that the account supports. + AuthenticationMethods []string `protobuf:"bytes,1,rep,name=authentication_methods,json=authenticationMethods,proto3" json:"authentication_methods,omitempty"` +} + +func (m *QueryAuthenticationMethodsResponse) Reset() { *m = QueryAuthenticationMethodsResponse{} } +func (m *QueryAuthenticationMethodsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAuthenticationMethodsResponse) ProtoMessage() {} +func (*QueryAuthenticationMethodsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{7} +} +func (m *QueryAuthenticationMethodsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthenticationMethodsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthenticationMethodsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAuthenticationMethodsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthenticationMethodsResponse.Merge(m, src) +} +func (m *QueryAuthenticationMethodsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthenticationMethodsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthenticationMethodsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthenticationMethodsResponse proto.InternalMessageInfo + +func (m *QueryAuthenticationMethodsResponse) GetAuthenticationMethods() []string { + if m != nil { + return m.AuthenticationMethods + } + return nil +} + +func init() { + proto.RegisterType((*MsgAuthenticate)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgAuthenticate") + proto.RegisterType((*MsgAuthenticateResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgAuthenticateResponse") + proto.RegisterType((*MsgPayBundler)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgPayBundler") + proto.RegisterType((*MsgPayBundlerResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgPayBundlerResponse") + proto.RegisterType((*MsgExecute)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgExecute") + proto.RegisterType((*MsgExecuteResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgExecuteResponse") + proto.RegisterType((*QueryAuthenticationMethods)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.QueryAuthenticationMethods") + proto.RegisterType((*QueryAuthenticationMethodsResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.QueryAuthenticationMethodsResponse") +} + +func init() { + proto.RegisterFile("cosmos/accounts/interfaces/account_abstraction/v1/interface.proto", fileDescriptor_56b360422260e9d1) +} + +var fileDescriptor_56b360422260e9d1 = []byte{ + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x3d, 0x6f, 0xd3, 0x40, + 0x18, 0xc7, 0xe3, 0x22, 0x81, 0xfa, 0x54, 0x05, 0x61, 0xd1, 0xe2, 0x04, 0x64, 0xa5, 0x9e, 0x32, + 0xa0, 0xb3, 0x5c, 0xc4, 0xc0, 0x98, 0x22, 0x24, 0x96, 0x40, 0x31, 0xb0, 0xc0, 0x60, 0x5d, 0x9c, + 0xa7, 0xae, 0x69, 0x73, 0x17, 0xdd, 0x73, 0x67, 0xc5, 0xdf, 0x82, 0x8f, 0xc5, 0xd8, 0x91, 0x11, + 0x25, 0x5f, 0x04, 0xe1, 0xb7, 0xb4, 0xa9, 0x53, 0xa5, 0x9b, 0xcf, 0xfe, 0x3d, 0xff, 0x97, 0x3b, + 0x1f, 0x0c, 0x63, 0x49, 0x53, 0x49, 0x3e, 0x8f, 0x63, 0x69, 0x84, 0x26, 0x3f, 0x15, 0x1a, 0xd5, + 0x19, 0x8f, 0xb1, 0x79, 0x17, 0xf1, 0x31, 0x69, 0xc5, 0x63, 0x9d, 0x4a, 0xe1, 0x67, 0xc1, 0x8a, + 0x60, 0x33, 0x25, 0xb5, 0xb4, 0x83, 0x52, 0x82, 0xd5, 0x12, 0x6c, 0x25, 0xc1, 0x5a, 0x24, 0x58, + 0x16, 0xf4, 0xba, 0x89, 0x94, 0xc9, 0x25, 0xfa, 0x85, 0xc0, 0xd8, 0x9c, 0xf9, 0x5c, 0xe4, 0xa5, + 0x5a, 0xef, 0xd5, 0x7a, 0xa0, 0x2c, 0x68, 0x0b, 0x52, 0xd2, 0x9e, 0x81, 0x27, 0x23, 0x4a, 0x86, + 0x46, 0x9f, 0xa3, 0xd0, 0x69, 0xcc, 0x35, 0xda, 0x0e, 0x3c, 0x1a, 0x1b, 0x31, 0xb9, 0x44, 0xe5, + 0x58, 0x7d, 0x6b, 0xb0, 0x1b, 0xd6, 0x4b, 0xfb, 0x03, 0x3c, 0x36, 0x84, 0x2a, 0x92, 0x33, 0x54, + 0xfc, 0xbf, 0x88, 0xb3, 0xd3, 0xb7, 0x06, 0x7b, 0xc7, 0x47, 0x6c, 0xbd, 0x41, 0x16, 0xb0, 0x6f, + 0x84, 0xea, 0x53, 0x0d, 0x86, 0xfb, 0xe6, 0xfa, 0xd2, 0xeb, 0xc2, 0xf3, 0x35, 0xdb, 0x10, 0x69, + 0x26, 0x05, 0xa1, 0x97, 0xc3, 0xfe, 0x88, 0x92, 0x53, 0x9e, 0x9f, 0x54, 0xae, 0x9b, 0xf3, 0x7c, + 0x04, 0xa7, 0x7a, 0x8c, 0x66, 0x3c, 0x9f, 0xa2, 0xd0, 0xd1, 0x14, 0x89, 0x78, 0x82, 0xe4, 0xec, + 0xf4, 0x1f, 0x0c, 0xf6, 0x8e, 0x9f, 0xb1, 0x72, 0xa3, 0x58, 0xbd, 0x51, 0x6c, 0x28, 0xf2, 0xf0, + 0xb0, 0x9a, 0x3a, 0x2d, 0x87, 0x46, 0xd5, 0x8c, 0x37, 0x87, 0x83, 0x1b, 0xd6, 0x75, 0x26, 0x3b, + 0x82, 0xa3, 0x4d, 0x46, 0x91, 0xaa, 0x20, 0xc7, 0xba, 0xc3, 0xd1, 0x6d, 0x77, 0x6c, 0x4a, 0x5f, + 0x00, 0x8c, 0x28, 0x79, 0x3f, 0xc7, 0xd8, 0xdc, 0x79, 0x02, 0xef, 0xc0, 0xc6, 0x02, 0x4a, 0xa5, + 0xd8, 0xae, 0xeb, 0xd3, 0x86, 0x6f, 0x6a, 0xfe, 0x04, 0x7b, 0x65, 0xd6, 0x74, 0xfc, 0x0a, 0x2f, + 0x6e, 0x4b, 0x6f, 0xd7, 0xae, 0x7b, 0xcb, 0xa3, 0x29, 0xf6, 0x12, 0x7a, 0x9f, 0x0d, 0xaa, 0xfc, + 0xda, 0x51, 0x17, 0x98, 0x3e, 0x97, 0x13, 0xf2, 0x7e, 0x80, 0xb7, 0xf9, 0x6b, 0x93, 0xec, 0x0d, + 0x1c, 0xf2, 0x1b, 0x40, 0x34, 0x2d, 0x89, 0x22, 0xd4, 0x6e, 0x78, 0xc0, 0xdb, 0xc6, 0x4f, 0xbe, + 0xfc, 0x5e, 0xb8, 0xd6, 0xd5, 0xc2, 0xb5, 0xfe, 0x2e, 0x5c, 0xeb, 0xd7, 0xd2, 0xed, 0x5c, 0x2d, + 0xdd, 0xce, 0x9f, 0xa5, 0xdb, 0xf9, 0xfe, 0xb6, 0xfc, 0x5d, 0x69, 0x72, 0xc1, 0x52, 0xe9, 0xcf, + 0xef, 0x71, 0x77, 0xc7, 0x0f, 0x8b, 0xe2, 0xaf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x78, 0x97, + 0xe4, 0x0c, 0xf7, 0x03, 0x00, 0x00, +} + +func (m *MsgAuthenticate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAuthenticate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAuthenticate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.UserOperation != nil { + { + size, err := m.UserOperation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Bundler) > 0 { + i -= len(m.Bundler) + copy(dAtA[i:], m.Bundler) + i = encodeVarintInterface(dAtA, i, uint64(len(m.Bundler))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAuthenticateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAuthenticateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAuthenticateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgPayBundler) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgPayBundler) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPayBundler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BundlerPaymentMessages) > 0 { + for iNdEx := len(m.BundlerPaymentMessages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BundlerPaymentMessages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Bundler) > 0 { + i -= len(m.Bundler) + copy(dAtA[i:], m.Bundler) + i = encodeVarintInterface(dAtA, i, uint64(len(m.Bundler))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPayBundlerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgPayBundlerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPayBundlerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BundlerPaymentMessagesResponse) > 0 { + for iNdEx := len(m.BundlerPaymentMessagesResponse) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BundlerPaymentMessagesResponse[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgExecute) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgExecute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ExecutionMessages) > 0 { + for iNdEx := len(m.ExecutionMessages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ExecutionMessages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Bundler) > 0 { + i -= len(m.Bundler) + copy(dAtA[i:], m.Bundler) + i = encodeVarintInterface(dAtA, i, uint64(len(m.Bundler))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExecuteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgExecuteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ExecutionMessagesResponse) > 0 { + for iNdEx := len(m.ExecutionMessagesResponse) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ExecutionMessagesResponse[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAuthenticationMethods) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAuthenticationMethods) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthenticationMethods) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAuthenticationMethodsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAuthenticationMethodsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthenticationMethodsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AuthenticationMethods) > 0 { + for iNdEx := len(m.AuthenticationMethods) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AuthenticationMethods[iNdEx]) + copy(dAtA[i:], m.AuthenticationMethods[iNdEx]) + i = encodeVarintInterface(dAtA, i, uint64(len(m.AuthenticationMethods[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintInterface(dAtA []byte, offset int, v uint64) int { + offset -= sovInterface(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgAuthenticate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bundler) + if l > 0 { + n += 1 + l + sovInterface(uint64(l)) + } + if m.UserOperation != nil { + l = m.UserOperation.Size() + n += 1 + l + sovInterface(uint64(l)) + } + return n +} + +func (m *MsgAuthenticateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgPayBundler) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bundler) + if l > 0 { + n += 1 + l + sovInterface(uint64(l)) + } + if len(m.BundlerPaymentMessages) > 0 { + for _, e := range m.BundlerPaymentMessages { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *MsgPayBundlerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BundlerPaymentMessagesResponse) > 0 { + for _, e := range m.BundlerPaymentMessagesResponse { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *MsgExecute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bundler) + if l > 0 { + n += 1 + l + sovInterface(uint64(l)) + } + if len(m.ExecutionMessages) > 0 { + for _, e := range m.ExecutionMessages { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *MsgExecuteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ExecutionMessagesResponse) > 0 { + for _, e := range m.ExecutionMessagesResponse { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *QueryAuthenticationMethods) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAuthenticationMethodsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AuthenticationMethods) > 0 { + for _, s := range m.AuthenticationMethods { + l = len(s) + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func sovInterface(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozInterface(x uint64) (n int) { + return sovInterface(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgAuthenticate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAuthenticate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAuthenticate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundler", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bundler = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserOperation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UserOperation == nil { + m.UserOperation = &v1.UserOperation{} + } + if err := m.UserOperation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAuthenticateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAuthenticateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAuthenticateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPayBundler) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgPayBundler: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPayBundler: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundler", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bundler = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundlerPaymentMessages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BundlerPaymentMessages = append(m.BundlerPaymentMessages, &types.Any{}) + if err := m.BundlerPaymentMessages[len(m.BundlerPaymentMessages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPayBundlerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgPayBundlerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPayBundlerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundlerPaymentMessagesResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BundlerPaymentMessagesResponse = append(m.BundlerPaymentMessagesResponse, &types.Any{}) + if err := m.BundlerPaymentMessagesResponse[len(m.BundlerPaymentMessagesResponse)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecute) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundler", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bundler = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecutionMessages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExecutionMessages = append(m.ExecutionMessages, &types.Any{}) + if err := m.ExecutionMessages[len(m.ExecutionMessages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecuteResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecuteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecuteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecutionMessagesResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExecutionMessagesResponse = append(m.ExecutionMessagesResponse, &types.Any{}) + if err := m.ExecutionMessagesResponse[len(m.ExecutionMessagesResponse)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuthenticationMethods) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAuthenticationMethods: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthenticationMethods: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuthenticationMethodsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAuthenticationMethodsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthenticationMethodsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticationMethods", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthenticationMethods = append(m.AuthenticationMethods, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipInterface(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowInterface + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowInterface + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowInterface + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthInterface + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupInterface + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthInterface + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthInterface = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowInterface = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupInterface = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/accounts/internal/implementation/account_test.go b/x/accounts/internal/implementation/account_test.go index 7654ea1d261c..938b98820043 100644 --- a/x/accounts/internal/implementation/account_test.go +++ b/x/accounts/internal/implementation/account_test.go @@ -3,8 +3,7 @@ package implementation import ( "context" - "google.golang.org/protobuf/types/known/emptypb" - "google.golang.org/protobuf/types/known/wrapperspb" + "github.com/cosmos/gogoproto/types" "cosmossdk.io/collections" ) @@ -26,31 +25,31 @@ type TestAccount struct { } func (TestAccount) RegisterInitHandler(builder *InitBuilder) { - RegisterInitHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { - return &wrapperspb.StringValue{Value: req.Value + "init-echo"}, nil + RegisterInitHandler(builder, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) { + return &types.StringValue{Value: req.Value + "init-echo"}, nil }) } func (t TestAccount) RegisterExecuteHandlers(builder *ExecuteBuilder) { - RegisterExecuteHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { - return &wrapperspb.StringValue{Value: req.Value + "execute-echo"}, nil + RegisterExecuteHandler(builder, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) { + return &types.StringValue{Value: req.Value + "execute-echo"}, nil }) - RegisterExecuteHandler(builder, func(_ context.Context, req *wrapperspb.BytesValue) (*wrapperspb.BytesValue, error) { - return &wrapperspb.BytesValue{Value: append(req.Value, "bytes-execute-echo"...)}, nil + RegisterExecuteHandler(builder, func(_ context.Context, req *types.BytesValue) (*types.BytesValue, error) { + return &types.BytesValue{Value: append(req.Value, "bytes-execute-echo"...)}, nil }) // State tester - RegisterExecuteHandler(builder, func(ctx context.Context, req *wrapperspb.UInt64Value) (*emptypb.Empty, error) { - return &emptypb.Empty{}, t.Item.Set(ctx, req.Value) + RegisterExecuteHandler(builder, func(ctx context.Context, req *types.UInt64Value) (*types.Empty, error) { + return &types.Empty{}, t.Item.Set(ctx, req.Value) }) } func (t TestAccount) RegisterQueryHandlers(builder *QueryBuilder) { - RegisterQueryHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { - return &wrapperspb.StringValue{Value: req.Value + "query-echo"}, nil + RegisterQueryHandler(builder, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) { + return &types.StringValue{Value: req.Value + "query-echo"}, nil }) - RegisterQueryHandler(builder, func(_ context.Context, req *wrapperspb.BytesValue) (*wrapperspb.BytesValue, error) { - return &wrapperspb.BytesValue{Value: append(req.Value, "bytes-query-echo"...)}, nil + RegisterQueryHandler(builder, func(_ context.Context, req *types.BytesValue) (*types.BytesValue, error) { + return &types.BytesValue{Value: append(req.Value, "bytes-query-echo"...)}, nil }) } diff --git a/x/accounts/internal/implementation/api_builder.go b/x/accounts/internal/implementation/api_builder.go index ee8344b86c1a..bd6e408215ea 100644 --- a/x/accounts/internal/implementation/api_builder.go +++ b/x/accounts/internal/implementation/api_builder.go @@ -4,18 +4,12 @@ import ( "context" "errors" "fmt" - - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/types/known/anypb" ) var ( errNoInitHandler = errors.New("no init handler") errNoExecuteHandler = errors.New("account does not accept messages") errInvalidMessage = errors.New("invalid message") - - protov2MarshalOpts = proto.MarshalOptions{Deterministic: true} ) // NewInitBuilder creates a new InitBuilder instance. @@ -28,7 +22,7 @@ type InitBuilder struct { // handler is the handler function that will be called when the smart account is initialized. // Although the function here is defined to take an any, the smart account will work // with a typed version of it. - handler func(ctx context.Context, initRequest any) (initResponse any, err error) + handler func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error) // schema is the schema of the message that will be passed to the handler function. schema HandlerSchema @@ -36,7 +30,7 @@ type InitBuilder struct { // makeHandler returns the handler function that will be called when the smart account is initialized. // It returns an error if no handler was registered. -func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest any) (initResponse any, err error), error) { +func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error), error) { if i.handler == nil { return nil, errNoInitHandler } @@ -46,7 +40,7 @@ func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest any) // NewExecuteBuilder creates a new ExecuteBuilder instance. func NewExecuteBuilder() *ExecuteBuilder { return &ExecuteBuilder{ - handlers: make(map[string]func(ctx context.Context, executeRequest any) (executeResponse any, err error)), + handlers: make(map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error)), handlersSchema: make(map[string]HandlerSchema), } } @@ -55,7 +49,7 @@ func NewExecuteBuilder() *ExecuteBuilder { // to a handler function for a specific account. type ExecuteBuilder struct { // handlers is a map of handler functions that will be called when the smart account is executed. - handlers map[string]func(ctx context.Context, executeRequest any) (executeResponse any, err error) + handlers map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) // handlersSchema is a map of schemas for the messages that will be passed to the handler functions // and the messages that will be returned by the handler functions. @@ -65,18 +59,10 @@ type ExecuteBuilder struct { err error } -func (r *ExecuteBuilder) getMessageName(msg any) (string, error) { - protoMsg, ok := msg.(protoreflect.ProtoMessage) - if !ok { - return "", fmt.Errorf("%w: expected protoreflect.Message, got %T", errInvalidMessage, msg) - } - return string(protoMsg.ProtoReflect().Descriptor().FullName()), nil -} - -func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest any) (executeResponse any, err error), error) { +func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error), error) { // if no handler is registered it's fine, it means the account will not be accepting execution or query messages. if len(r.handlers) == 0 { - return func(ctx context.Context, _ any) (_ any, err error) { + return func(ctx context.Context, _ ProtoMsg) (_ ProtoMsg, err error) { return nil, errNoExecuteHandler }, nil } @@ -86,11 +72,8 @@ func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest } // build the real execution handler - return func(ctx context.Context, executeRequest any) (executeResponse any, err error) { - messageName, err := r.getMessageName(executeRequest) - if err != nil { - return nil, fmt.Errorf("%w: unable to get message name", err) - } + return func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) { + messageName := MessageName(executeRequest) handler, ok := r.handlers[messageName] if !ok { return nil, fmt.Errorf("%w: no handler for message %s", errInvalidMessage, messageName) @@ -99,42 +82,6 @@ func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest }, nil } -func (r *ExecuteBuilder) makeRequestDecoder() func(requestBytes []byte) (any, error) { - return func(requestBytes []byte) (any, error) { - anyPB := new(anypb.Any) - err := proto.Unmarshal(requestBytes, anyPB) - if err != nil { - return nil, err - } - - msg, err := anyPB.UnmarshalNew() - if err != nil { - return nil, err - } - - // we do not check if it is part of a valid message set as an account can handle - // and the handler will do so. - return msg, nil - } -} - -func (r *ExecuteBuilder) makeResponseEncoder() func(executeResponse any) ([]byte, error) { - return func(executeResponse any) ([]byte, error) { - executeResponsePB, ok := executeResponse.(protoreflect.ProtoMessage) - if !ok { - return nil, fmt.Errorf("%w: expected protoreflect.Message, got %T", errInvalidMessage, executeResponse) - } - anyPB, err := anypb.New(executeResponsePB) - if err != nil { - return nil, err - } - - // we do not check if it is part of an account's valid response message set - // as make handler will never allow for an invalid response to be returned. - return protov2MarshalOpts.Marshal(anyPB) - } -} - // NewQueryBuilder creates a new QueryBuilder instance. func NewQueryBuilder() *QueryBuilder { return &QueryBuilder{ @@ -149,7 +96,7 @@ type QueryBuilder struct { er *ExecuteBuilder } -func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest any) (queryResponse any, err error), error) { +func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest ProtoMsg) (queryResponse ProtoMsg, err error), error) { return r.er.makeHandler() } diff --git a/x/accounts/internal/implementation/api_builder_test.go b/x/accounts/internal/implementation/api_builder_test.go index 8382ea8b8b69..acad2af651db 100644 --- a/x/accounts/internal/implementation/api_builder_test.go +++ b/x/accounts/internal/implementation/api_builder_test.go @@ -4,14 +4,14 @@ import ( "context" "testing" + "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/types/known/wrapperspb" ) func TestRouterDoubleRegistration(t *testing.T) { router := NewExecuteBuilder() - RegisterExecuteHandler(router, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { return nil, nil }) - RegisterExecuteHandler(router, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { return nil, nil }) + RegisterExecuteHandler(router, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) { return nil, nil }) + RegisterExecuteHandler(router, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) { return nil, nil }) _, err := router.makeHandler() require.ErrorContains(t, err, "already registered") @@ -28,8 +28,8 @@ func TestEmptyQueryExecuteHandler(t *testing.T) { ctx := context.Background() - _, err = qh(ctx, &wrapperspb.StringValue{}) + _, err = qh(ctx, &types.StringValue{}) require.ErrorIs(t, err, errNoExecuteHandler) - _, err = eh(ctx, &wrapperspb.StringValue{}) + _, err = eh(ctx, &types.StringValue{}) require.ErrorIs(t, err, errNoExecuteHandler) } diff --git a/x/accounts/internal/implementation/context.go b/x/accounts/internal/implementation/context.go index 7f14a73d04ce..38cc07521013 100644 --- a/x/accounts/internal/implementation/context.go +++ b/x/accounts/internal/implementation/context.go @@ -2,8 +2,7 @@ package implementation import ( "context" - - "google.golang.org/protobuf/proto" + "encoding/binary" "cosmossdk.io/collections" "cosmossdk.io/core/store" @@ -13,9 +12,9 @@ import ( var AccountStatePrefix = collections.NewPrefix(255) type ( - ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error) - ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp proto.Message) error - ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp proto.Message) error + ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) + ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error + ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error ) type contextKey struct{} @@ -40,14 +39,15 @@ type contextValue struct { func MakeAccountContext( ctx context.Context, storeSvc store.KVStoreService, - accountAddr, + accNumber uint64, + accountAddr []byte, sender []byte, moduleExec ModuleExecFunc, moduleExecUntyped ModuleExecUntypedFunc, moduleQuery ModuleQueryFunc, ) context.Context { return context.WithValue(ctx, contextKey{}, contextValue{ - store: prefixstore.New(storeSvc.OpenKVStore(ctx), append(AccountStatePrefix, accountAddr...)), + store: makeAccountStore(ctx, storeSvc, accNumber), sender: sender, whoami: accountAddr, originalContext: ctx, @@ -57,8 +57,17 @@ func MakeAccountContext( }) } +// makeAccountStore creates the prefixed store for the account. +// It uses the number of the account, this gives constant size +// bytes prefixes for the account state. +func makeAccountStore(ctx context.Context, storeSvc store.KVStoreService, accNum uint64) store.KVStore { + prefix := make([]byte, 8) + binary.BigEndian.PutUint64(prefix, accNum) + return prefixstore.New(storeSvc.OpenKVStore(ctx), append(AccountStatePrefix, prefix...)) +} + // ExecModuleUntyped can be used to execute a message towards a module, when the response type is unknown. -func ExecModuleUntyped(ctx context.Context, msg proto.Message) (proto.Message, error) { +func ExecModuleUntyped(ctx context.Context, msg ProtoMsg) (ProtoMsg, error) { // get sender v := ctx.Value(contextKey{}).(contextValue) @@ -71,7 +80,7 @@ func ExecModuleUntyped(ctx context.Context, msg proto.Message) (proto.Message, e } // ExecModule can be used to execute a message towards a module. -func ExecModule[Resp any, RespProto ProtoMsg[Resp], Req any, ReqProto ProtoMsg[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { +func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { // get sender v := ctx.Value(contextKey{}).(contextValue) @@ -86,7 +95,7 @@ func ExecModule[Resp any, RespProto ProtoMsg[Resp], Req any, ReqProto ProtoMsg[R } // QueryModule can be used by an account to execute a module query. -func QueryModule[Resp any, RespProto ProtoMsg[Resp], Req any, ReqProto ProtoMsg[Req]](ctx context.Context, req ReqProto) (RespProto, error) { +func QueryModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) { // we do not need to check the sender in a query because it is not a state transition. // we also unwrap the original context. v := ctx.Value(contextKey{}).(contextValue) diff --git a/x/accounts/internal/implementation/context_test.go b/x/accounts/internal/implementation/context_test.go index 327445fb7623..2c8db80ca2cf 100644 --- a/x/accounts/internal/implementation/context_test.go +++ b/x/accounts/internal/implementation/context_test.go @@ -2,11 +2,11 @@ package implementation import ( "context" + "encoding/binary" "testing" + "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/wrapperspb" "cosmossdk.io/collections" "cosmossdk.io/collections/colltest" @@ -18,7 +18,7 @@ func TestMakeAccountContext(t *testing.T) { sender := []byte("sender") sb := collections.NewSchemaBuilderFromAccessor(OpenKVStore) - accountCtx := MakeAccountContext(originalContext, storeService, accountAddr, sender, nil, nil, nil) + accountCtx := MakeAccountContext(originalContext, storeService, 1, accountAddr, sender, nil, nil, nil) // ensure whoami require.Equal(t, accountAddr, Whoami(accountCtx)) @@ -28,52 +28,52 @@ func TestMakeAccountContext(t *testing.T) { ta, err := NewTestAccount(sb) require.NoError(t, err) - impl, err := NewImplementation(ta) + impl, err := newImplementation(sb, ta) require.NoError(t, err) - _, err = impl.Execute(accountCtx, &wrapperspb.UInt64Value{Value: 1000}) + _, err = impl.Execute(accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) // we want to ensure that the account wrote in the correct prefix. // this store is the global x/accounts module store. store := storeService.OpenKVStore(originalContext) - // now we want the value to be store in the following accounts prefix (AccountsStatePrefix + accountAddr + itemPrefix) - value, err := store.Get(append(AccountStatePrefix, append(accountAddr, itemPrefix...)...)) + // now we want the value to be store in the following accounts prefix (AccountsStatePrefix + big_endian(acc_number=1) + itemPrefix) + value, err := store.Get(append(AccountStatePrefix, append(binary.BigEndian.AppendUint64(nil, 1), itemPrefix...)...)) require.NoError(t, err) require.Equal(t, []byte{0, 0, 0, 0, 0, 0, 3, 232}, value) // ensure calling ExecModule works - accountCtx = MakeAccountContext(originalContext, storeService, []byte("legit-exec-module"), []byte("invoker"), func(ctx context.Context, sender []byte, msg, msgResp proto.Message) error { + accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module"), []byte("invoker"), func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { // ensure we unwrapped the context when invoking a module call require.Equal(t, originalContext, ctx) - proto.Merge(msgResp, &wrapperspb.StringValue{Value: "module exec was called"}) + Merge(msgResp, &types.StringValue{Value: "module exec was called"}) return nil }, nil, nil) - resp, err := ExecModule[wrapperspb.StringValue](accountCtx, &wrapperspb.UInt64Value{Value: 1000}) + resp, err := ExecModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) - require.True(t, proto.Equal(wrapperspb.String("module exec was called"), resp)) + require.True(t, Equal(&types.StringValue{Value: "module exec was called"}, resp)) // ensure calling ExecModuleUntyped works - accountCtx = MakeAccountContext(originalContext, storeService, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error) { + accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { require.Equal(t, originalContext, ctx) - return &wrapperspb.StringValue{Value: "module exec untyped was called"}, nil + return &types.StringValue{Value: "module exec untyped was called"}, nil }, nil) - respUntyped, err := ExecModuleUntyped(accountCtx, &wrapperspb.UInt64Value{Value: 1000}) + respUntyped, err := ExecModuleUntyped(accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) - require.True(t, proto.Equal(wrapperspb.String("module exec untyped was called"), respUntyped)) + require.True(t, Equal(&types.StringValue{Value: "module exec untyped was called"}, respUntyped)) // ensure calling QueryModule works, also by setting everything else communication related to nil // we can guarantee that exec paths do not impact query paths. - accountCtx = MakeAccountContext(originalContext, storeService, nil, nil, nil, nil, func(ctx context.Context, req, resp proto.Message) error { + accountCtx = MakeAccountContext(originalContext, storeService, 1, nil, nil, nil, nil, func(ctx context.Context, req, resp ProtoMsg) error { require.Equal(t, originalContext, ctx) - proto.Merge(resp, wrapperspb.String("module query was called")) + Merge(resp, &types.StringValue{Value: "module query was called"}) return nil }) - resp, err = QueryModule[wrapperspb.StringValue](accountCtx, &wrapperspb.UInt64Value{Value: 1000}) + resp, err = QueryModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) - require.True(t, proto.Equal(wrapperspb.String("module query was called"), resp)) + require.True(t, Equal(&types.StringValue{Value: "module query was called"}, resp)) } diff --git a/x/accounts/internal/implementation/encoding.go b/x/accounts/internal/implementation/encoding.go new file mode 100644 index 000000000000..93e096ab0cb8 --- /dev/null +++ b/x/accounts/internal/implementation/encoding.go @@ -0,0 +1,59 @@ +package implementation + +import ( + "fmt" + "reflect" + "strings" + + "github.com/cosmos/gogoproto/proto" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" +) + +type Any = codectypes.Any + +func FindMessageByName(name string) (ProtoMsg, error) { + typ := proto.MessageType(name) + if typ == nil { + return nil, fmt.Errorf("no message type found for %s", name) + } + return reflect.New(typ.Elem()).Interface().(ProtoMsg), nil +} + +func MessageName(msg ProtoMsg) string { + return proto.MessageName(msg) +} + +// PackAny packs a proto message into an anypb.Any. +func PackAny(msg ProtoMsg) (*Any, error) { + return codectypes.NewAnyWithValue(msg) +} + +// UnpackAny unpacks an anypb.Any into a proto message. +func UnpackAny[T any, PT ProtoMsgG[T]](anyPB *Any) (PT, error) { + to := new(T) + return to, UnpackAnyTo(anyPB, PT(to)) +} + +func UnpackAnyTo(anyPB *Any, to ProtoMsg) error { + return proto.Unmarshal(anyPB.Value, to) +} + +func UnpackAnyRaw(anyPB *Any) (proto.Message, error) { + split := strings.Split(anyPB.TypeUrl, "/") + name := split[len(split)-1] + typ := proto.MessageType(name) + if typ == nil { + return nil, fmt.Errorf("no message type found for %s", name) + } + to := reflect.New(typ.Elem()).Interface().(proto.Message) + return to, UnpackAnyTo(anyPB, to) +} + +func Merge(a, b ProtoMsg) { + proto.Merge(a, b) +} + +func Equal(a, b ProtoMsg) bool { + return proto.Equal(a, b) +} diff --git a/x/accounts/internal/implementation/implementation.go b/x/accounts/internal/implementation/implementation.go index 9587afdb0fb8..4023ef608af4 100644 --- a/x/accounts/internal/implementation/implementation.go +++ b/x/accounts/internal/implementation/implementation.go @@ -15,24 +15,7 @@ type Dependencies struct { } // AccountCreatorFunc is a function that creates an account. -type AccountCreatorFunc = func(deps Dependencies) (string, Implementation, error) - -// AddAccount is a helper function to add a smart account to the list of smart accounts. -// It returns a function that given an Account implementer, returns the name of the account -// and the Implementation instance. -func AddAccount[A Account](name string, constructor func(deps Dependencies) (A, error)) func(deps Dependencies) (string, Implementation, error) { - return func(deps Dependencies) (string, Implementation, error) { - acc, err := constructor(deps) - if err != nil { - return "", Implementation{}, err - } - impl, err := NewImplementation(acc) - if err != nil { - return "", Implementation{}, err - } - return name, impl, nil - } -} +type AccountCreatorFunc = func(deps Dependencies) (string, Account, error) // MakeAccountsMap creates a map of account names to account implementations // from a list of account creator functions. @@ -44,27 +27,25 @@ func MakeAccountsMap(addressCodec address.Codec, accounts []AccountCreatorFunc) SchemaBuilder: stateSchemaBuilder, AddressCodec: addressCodec, } - name, impl, err := makeAccount(deps) + name, accountInterface, err := makeAccount(deps) if err != nil { return nil, fmt.Errorf("failed to create account %s: %w", name, err) } if _, ok := accountsMap[name]; ok { return nil, fmt.Errorf("account %s is already registered", name) } - // build schema - schema, err := stateSchemaBuilder.Build() + impl, err := newImplementation(stateSchemaBuilder, accountInterface) if err != nil { - return nil, fmt.Errorf("failed to build schema for account %s: %w", name, err) + return nil, fmt.Errorf("failed to create implementation for account %s: %w", name, err) } - impl.CollectionsSchema = schema accountsMap[name] = impl } return accountsMap, nil } -// NewImplementation creates a new Implementation instance given an Account implementer. -func NewImplementation(account Account) (Implementation, error) { +// newImplementation creates a new Implementation instance given an Account implementer. +func newImplementation(schemaBuilder *collections.SchemaBuilder, account Account) (Implementation, error) { // make init handler ir := NewInitBuilder() account.RegisterInitHandler(ir) @@ -88,18 +69,20 @@ func NewImplementation(account Account) (Implementation, error) { if err != nil { return Implementation{}, err } + + // build schema + schema, err := schemaBuilder.Build() + if err != nil { + return Implementation{}, err + } return Implementation{ Init: initHandler, Execute: executeHandler, Query: queryHandler, - CollectionsSchema: collections.Schema{}, + CollectionsSchema: schema, InitHandlerSchema: ir.schema, QueryHandlersSchema: qr.er.handlersSchema, ExecuteHandlersSchema: er.handlersSchema, - DecodeExecuteRequest: er.makeRequestDecoder(), - EncodeExecuteResponse: er.makeResponseEncoder(), - DecodeQueryRequest: qr.er.makeRequestDecoder(), - EncodeQueryResponse: qr.er.makeResponseEncoder(), }, nil } @@ -107,11 +90,11 @@ func NewImplementation(account Account) (Implementation, error) { // and non-generic implementation usable by the x/accounts module. type Implementation struct { // Init defines the initialisation handler for the smart account. - Init func(ctx context.Context, msg any) (resp any, err error) + Init func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) // Execute defines the execution handler for the smart account. - Execute func(ctx context.Context, msg any) (resp any, err error) + Execute func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) // Query defines the query handler for the smart account. - Query func(ctx context.Context, msg any) (resp any, err error) + Query func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) // CollectionsSchema represents the state schema. CollectionsSchema collections.Schema // InitHandlerSchema represents the init handler schema. @@ -120,37 +103,15 @@ type Implementation struct { QueryHandlersSchema map[string]HandlerSchema // ExecuteHandlersSchema is the schema of the execute handlers. ExecuteHandlersSchema map[string]HandlerSchema - - // TODO: remove these fields and use the schemas instead - - // DecodeExecuteRequest decodes an execute request coming from the message server. - DecodeExecuteRequest func([]byte) (any, error) - // EncodeExecuteResponse encodes an execute response to be sent back from the message server. - EncodeExecuteResponse func(any) ([]byte, error) - - // DecodeQueryRequest decodes a query request coming from the message server. - DecodeQueryRequest func([]byte) (any, error) - // EncodeQueryResponse encodes a query response to be sent back from the message server. - EncodeQueryResponse func(any) ([]byte, error) } // MessageSchema defines the schema of a message. // A message can also define a state schema. type MessageSchema struct { - // Name identifies the message name, this must be queriable from some reflection service. + // Name identifies the message name, this must be queryable from some reflection service. Name string - // TxDecode decodes into the message from transaction bytes. - // CONSENSUS SAFE: can be used in state machine logic. - TxDecode func([]byte) (any, error) - // TxEncode encodes the message into transaction bytes. - // CONSENSUS SAFE: can be used in state machine logic. - TxEncode func(any) ([]byte, error) - // HumanDecode decodes into the message from human-readable bytes. - // CONSENSUS UNSAFE: can be used only from clients, not state machine logic. - HumanDecode func([]byte) (any, error) - // HumanEncode encodes the message into human-readable bytes. - // CONSENSUS UNSAFE: can be used only from clients, not state machine logic. - HumanEncode func(any) ([]byte, error) + // New is used to create a new message instance for the schema. + New func() ProtoMsg } // HandlerSchema defines the schema of a handler. diff --git a/x/accounts/internal/implementation/implementation_test.go b/x/accounts/internal/implementation/implementation_test.go index 7b42fd8b53ea..1aeb5ddd2025 100644 --- a/x/accounts/internal/implementation/implementation_test.go +++ b/x/accounts/internal/implementation/implementation_test.go @@ -4,117 +4,56 @@ import ( "context" "testing" + "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/types/known/anypb" - "google.golang.org/protobuf/types/known/wrapperspb" + + "cosmossdk.io/collections" ) func TestImplementation(t *testing.T) { - impl, err := NewImplementation(TestAccount{}) + impl, err := newImplementation(collections.NewSchemaBuilderFromAccessor(OpenKVStore), TestAccount{}) require.NoError(t, err) ctx := context.Background() t.Run("execute ok", func(t *testing.T) { - resp, err := impl.Execute(ctx, &wrapperspb.StringValue{Value: "test"}) + resp, err := impl.Execute(ctx, &types.StringValue{Value: "test"}) require.NoError(t, err) - require.Equal(t, "testexecute-echo", resp.(*wrapperspb.StringValue).Value) + require.Equal(t, "testexecute-echo", resp.(*types.StringValue).Value) - resp, err = impl.Execute(ctx, &wrapperspb.BytesValue{Value: []byte("test")}) + resp, err = impl.Execute(ctx, &types.BytesValue{Value: []byte("test")}) require.NoError(t, err) - require.Equal(t, "testbytes-execute-echo", string(resp.(*wrapperspb.BytesValue).Value)) + require.Equal(t, "testbytes-execute-echo", string(resp.(*types.BytesValue).Value)) }) t.Run("execute - unknown message", func(t *testing.T) { - _, err := impl.Execute(ctx, &wrapperspb.Int32Value{Value: 1}) + _, err := impl.Execute(ctx, &types.Int32Value{Value: 1}) require.ErrorIs(t, err, errInvalidMessage) }) t.Run("init ok", func(t *testing.T) { - resp, err := impl.Init(ctx, &wrapperspb.StringValue{Value: "test"}) + resp, err := impl.Init(ctx, &types.StringValue{Value: "test"}) require.NoError(t, err) - require.Equal(t, "testinit-echo", resp.(*wrapperspb.StringValue).Value) + require.Equal(t, "testinit-echo", resp.(*types.StringValue).Value) }) t.Run("init - unknown message", func(t *testing.T) { - _, err := impl.Init(ctx, &wrapperspb.Int32Value{Value: 1}) + _, err := impl.Init(ctx, &types.Int32Value{Value: 1}) require.ErrorIs(t, err, errInvalidMessage) }) t.Run("query ok", func(t *testing.T) { - resp, err := impl.Query(ctx, &wrapperspb.StringValue{Value: "test"}) + resp, err := impl.Query(ctx, &types.StringValue{Value: "test"}) require.NoError(t, err) - require.Equal(t, "testquery-echo", resp.(*wrapperspb.StringValue).Value) + require.Equal(t, "testquery-echo", resp.(*types.StringValue).Value) - resp, err = impl.Query(ctx, &wrapperspb.BytesValue{Value: []byte("test")}) + resp, err = impl.Query(ctx, &types.BytesValue{Value: []byte("test")}) require.NoError(t, err) - require.Equal(t, "testbytes-query-echo", string(resp.(*wrapperspb.BytesValue).Value)) + require.Equal(t, "testbytes-query-echo", string(resp.(*types.BytesValue).Value)) }) t.Run("query - unknown message", func(t *testing.T) { - _, err := impl.Query(ctx, &wrapperspb.Int32Value{Value: 1}) - require.ErrorIs(t, err, errInvalidMessage) - }) - - t.Run("all - not a protobuf message", func(t *testing.T) { - _, err := impl.Execute(ctx, "test") - require.ErrorIs(t, err, errInvalidMessage) - _, err = impl.Query(ctx, "test") - require.ErrorIs(t, err, errInvalidMessage) - _, err = impl.Init(ctx, "test") - require.ErrorIs(t, err, errInvalidMessage) - }) - - // schemas - t.Run("decode init request - ok", func(t *testing.T) { - want := &wrapperspb.StringValue{Value: "test"} - req, err := impl.InitHandlerSchema.ResponseSchema.TxEncode(want) - require.NoError(t, err) - - got, err := impl.InitHandlerSchema.RequestSchema.TxDecode(req) - require.NoError(t, err) - require.True(t, proto.Equal(want, got.(protoreflect.ProtoMessage))) - }) - - t.Run("encode init response - ok", func(t *testing.T) { - want := &wrapperspb.StringValue{Value: "test"} - - gotBytes, err := impl.InitHandlerSchema.ResponseSchema.TxEncode(want) - require.NoError(t, err) - - wantBytes, err := proto.Marshal(want) - require.NoError(t, err) - - require.Equal(t, wantBytes, gotBytes) - }) - - t.Run("decode execute request - ok", func(t *testing.T) { - wantReq := &wrapperspb.StringValue{Value: "test"} - anyBPReq, err := anypb.New(wantReq) - require.NoError(t, err) - reqBytes, err := proto.Marshal(anyBPReq) - require.NoError(t, err) - gotReq, err := impl.DecodeExecuteRequest(reqBytes) - require.NoError(t, err) - require.True(t, proto.Equal(wantReq, gotReq.(protoreflect.ProtoMessage))) - }) - - t.Run("encode execute response - ok", func(t *testing.T) { - resp := &wrapperspb.StringValue{Value: "test"} - gotRespBytes, err := impl.EncodeExecuteResponse(resp) - require.NoError(t, err) - anyPBResp, err := anypb.New(resp) - require.NoError(t, err) - wantRespBytes, err := proto.Marshal(anyPBResp) - require.NoError(t, err) - require.Equal(t, wantRespBytes, gotRespBytes) - }) - - t.Run("encode execute response - not a protobuf message", func(t *testing.T) { - _, err := impl.EncodeExecuteResponse("test") + _, err := impl.Query(ctx, &types.Int32Value{Value: 1}) require.ErrorIs(t, err, errInvalidMessage) - require.ErrorContains(t, err, "expected protoreflect.Message") }) } diff --git a/x/accounts/internal/implementation/proto_util.go b/x/accounts/internal/implementation/proto_util.go deleted file mode 100644 index caf89a4af2dc..000000000000 --- a/x/accounts/internal/implementation/proto_util.go +++ /dev/null @@ -1,31 +0,0 @@ -package implementation - -import ( - "github.com/cosmos/cosmos-proto/anyutil" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" -) - -// PackAny packs a proto message into an anypb.Any. -func PackAny(msg proto.Message) (*anypb.Any, error) { - anyPB := new(anypb.Any) - return anyPB, anyutil.MarshalFrom(anyPB, msg, proto.MarshalOptions{Deterministic: true}) -} - -// UnpackAny unpacks an anypb.Any into a proto message. -func UnpackAny[T any, PT ProtoMsg[T]](anyPB *anypb.Any) (PT, error) { - to := new(T) - return to, UnpackAnyTo(anyPB, PT(to)) -} - -func UnpackAnyTo(anyPB *anypb.Any, to proto.Message) error { - return anypb.UnmarshalTo(anyPB, to, proto.UnmarshalOptions{ - DiscardUnknown: true, - }) -} - -func UnpackAnyRaw(anyPB *anypb.Any) (proto.Message, error) { - return anypb.UnmarshalNew(anyPB, proto.UnmarshalOptions{ - DiscardUnknown: true, - }) -} diff --git a/x/accounts/internal/implementation/protoaccount.go b/x/accounts/internal/implementation/protoaccount.go index 23b0145f39e9..299e48eb6263 100644 --- a/x/accounts/internal/implementation/protoaccount.go +++ b/x/accounts/internal/implementation/protoaccount.go @@ -4,27 +4,26 @@ import ( "context" "fmt" - "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/runtime/protoiface" ) -// ProtoMsg is a generic interface for protobuf messages. -type ProtoMsg[T any] interface { +type ProtoMsg = protoiface.MessageV1 + +// ProtoMsgG is a generic interface for protobuf messages. +type ProtoMsgG[T any] interface { *T - protoreflect.ProtoMessage protoiface.MessageV1 } // RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf. func RegisterInitHandler[ - Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp], + Req any, ProtoReq ProtoMsgG[Req], Resp any, ProtoResp ProtoMsgG[Resp], ](router *InitBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), ) { - reqName := ProtoReq(new(Req)).ProtoReflect().Descriptor().FullName() + reqName := MessageName(ProtoReq(new(Req))) - router.handler = func(ctx context.Context, initRequest any) (initResponse any, err error) { + router.handler = func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error) { concrete, ok := initRequest.(ProtoReq) if !ok { return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, initRequest) @@ -40,17 +39,17 @@ func RegisterInitHandler[ // RegisterExecuteHandler registers an execution handler for a smart account that uses protobuf. func RegisterExecuteHandler[ - Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp], + Req any, ProtoReq ProtoMsgG[Req], Resp any, ProtoResp ProtoMsgG[Resp], ](router *ExecuteBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), ) { - reqName := ProtoReq(new(Req)).ProtoReflect().Descriptor().FullName() + reqName := MessageName(ProtoReq(new(Req))) // check if not registered already - if _, ok := router.handlers[string(reqName)]; ok { + if _, ok := router.handlers[reqName]; ok { router.err = fmt.Errorf("handler already registered for message %s", reqName) return } - router.handlers[string(reqName)] = func(ctx context.Context, executeRequest any) (executeResponse any, err error) { + router.handlers[reqName] = func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) { concrete, ok := executeRequest.(ProtoReq) if !ok { return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, executeRequest) @@ -58,7 +57,7 @@ func RegisterExecuteHandler[ return handler(ctx, concrete) } - router.handlersSchema[string(reqName)] = HandlerSchema{ + router.handlersSchema[reqName] = HandlerSchema{ RequestSchema: *NewProtoMessageSchema[Req, ProtoReq](), ResponseSchema: *NewProtoMessageSchema[Resp, ProtoResp](), } @@ -66,50 +65,21 @@ func RegisterExecuteHandler[ // RegisterQueryHandler registers a query handler for a smart account that uses protobuf. func RegisterQueryHandler[ - Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp], + Req any, ProtoReq ProtoMsgG[Req], Resp any, ProtoResp ProtoMsgG[Resp], ](router *QueryBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error), ) { RegisterExecuteHandler(router.er, handler) } -func NewProtoMessageSchema[T any, PT ProtoMsg[T]]() *MessageSchema { +func NewProtoMessageSchema[T any, PT ProtoMsgG[T]]() *MessageSchema { msg := PT(new(T)) - marshaler := proto.MarshalOptions{Deterministic: true} - unmarshaler := proto.UnmarshalOptions{DiscardUnknown: true} // TODO: safe to discard unknown? or should reject? - jsonMarshaler := protojson.MarshalOptions{ - Multiline: true, - Indent: " ", - UseProtoNames: true, - } - jsonUnmarshaler := protojson.UnmarshalOptions{ - DiscardUnknown: true, + if _, ok := (interface{}(msg)).(proto.Message); ok { + panic("protov2 messages are not supported") } - return &MessageSchema{ - Name: string(msg.ProtoReflect().Descriptor().FullName()), - TxDecode: func(bytes []byte) (any, error) { - obj := PT(new(T)) - err := unmarshaler.Unmarshal(bytes, obj) - return obj, err - }, - TxEncode: func(a any) ([]byte, error) { - concrete, ok := a.(PT) - if !ok { - return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, msg.ProtoReflect().Descriptor().FullName(), a) - } - return marshaler.Marshal(concrete) - }, - HumanDecode: func(bytes []byte) (any, error) { - obj := PT(new(T)) - err := jsonUnmarshaler.Unmarshal(bytes, obj) - return obj, err - }, - HumanEncode: func(a any) ([]byte, error) { - concrete, ok := a.(PT) - if !ok { - return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, msg.ProtoReflect().Descriptor().FullName(), a) - } - return jsonMarshaler.Marshal(concrete) + Name: MessageName(msg), + New: func() ProtoMsg { + return PT(new(T)) }, } } diff --git a/x/accounts/internal/prefixstore/prefixstore.go b/x/accounts/internal/prefixstore/prefixstore.go index 16a29fd7ae28..3121691a25df 100644 --- a/x/accounts/internal/prefixstore/prefixstore.go +++ b/x/accounts/internal/prefixstore/prefixstore.go @@ -23,7 +23,7 @@ var _ store.KVStore = Store{} // Store is similar with cometbft/cometbft/libs/db/prefix_db // both gives access only to the limited subset of the store -// for convinience or safety +// for convenience or safety type Store struct { parent store.KVStore prefix []byte diff --git a/x/accounts/keeper.go b/x/accounts/keeper.go index 913f4d5fd549..f2561e5e60c2 100644 --- a/x/accounts/keeper.go +++ b/x/accounts/keeper.go @@ -8,11 +8,8 @@ import ( "errors" "fmt" + gogoproto "github.com/cosmos/gogoproto/proto" "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/reflect/protoregistry" - "google.golang.org/protobuf/runtime/protoiface" - "google.golang.org/protobuf/types/known/anypb" "cosmossdk.io/collections" "cosmossdk.io/core/address" @@ -21,8 +18,6 @@ import ( "cosmossdk.io/core/store" "cosmossdk.io/x/accounts/accountstd" "cosmossdk.io/x/accounts/internal/implementation" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" ) var ( @@ -44,24 +39,29 @@ var ( // It returns the handler given the message name, if multiple handlers are returned, then // it is up to the caller to choose which one to call. type QueryRouter interface { - HybridHandlerByRequestName(name string) []func(ctx context.Context, req, resp protoiface.MessageV1) error + HybridHandlerByRequestName(name string) []func(ctx context.Context, req, resp implementation.ProtoMsg) error } // MsgRouter represents a router which can be used to route messages to the correct module. type MsgRouter interface { - HybridHandlerByMsgName(msgName string) func(ctx context.Context, req, resp protoiface.MessageV1) error + HybridHandlerByMsgName(msgName string) func(ctx context.Context, req, resp implementation.ProtoMsg) error ResponseNameByRequestName(name string) string } // SignerProvider defines an interface used to get the expected sender from a message. type SignerProvider interface { - // GetSigners returns the signers of the message. - GetSigners(msg proto.Message) ([][]byte, error) + // GetMsgV1Signers returns the signers of the message. + GetMsgV1Signers(msg gogoproto.Message) ([][]byte, proto.Message, error) } // BranchExecutor defines an interface used to execute ops in a branch. type BranchExecutor = branch.Service +type InterfaceRegistry interface { + RegisterInterface(name string, iface any, impls ...gogoproto.Message) + RegisterImplementations(iface any, impls ...gogoproto.Message) +} + func NewKeeper( ss store.KVStoreService, es event.Service, @@ -70,6 +70,7 @@ func NewKeeper( signerProvider SignerProvider, execRouter MsgRouter, queryRouter QueryRouter, + ir InterfaceRegistry, accounts ...accountstd.AccountCreatorFunc, ) (Keeper, error) { sb := collections.NewSchemaBuilder(ss) @@ -85,7 +86,7 @@ func NewKeeper( AccountNumber: collections.NewSequence(sb, AccountNumberKey, "account_number"), AccountsByType: collections.NewMap(sb, AccountTypeKeyPrefix, "accounts_by_type", collections.BytesKey, collections.StringValue), AccountByNumber: collections.NewMap(sb, AccountByNumber, "account_by_number", collections.BytesKey, collections.Uint64Value), - AccountsState: collections.NewMap(sb, implementation.AccountStatePrefix, "accounts_state", collections.BytesKey, collections.BytesValue), + AccountsState: collections.NewMap(sb, implementation.AccountStatePrefix, "accounts_state", collections.PairKeyCodec(collections.Uint64Key, collections.BytesKey), collections.BytesValue), } schema, err := sb.Build() @@ -97,6 +98,7 @@ func NewKeeper( if err != nil { return Keeper{}, err } + registerToInterfaceRegistry(ir, keeper.accounts) return keeper, nil } @@ -123,9 +125,9 @@ type Keeper struct { // AccountsState keeps track of the state of each account. // NOTE: this is only used for genesis import and export. - // Contracts set and get their own state but this helps providing a nice mapping - // between: (account address, account state key) => account state value. - AccountsState collections.Map[[]byte, []byte] + // Account set and get their own state but this helps providing a nice mapping + // between: (account number, account state key) => account state value. + AccountsState collections.Map[collections.Pair[uint64, []byte], []byte] } // Init creates a new account of the given type. @@ -133,8 +135,8 @@ func (k Keeper) Init( ctx context.Context, accountType string, creator []byte, - initRequest any, -) (any, []byte, error) { + initRequest implementation.ProtoMsg, +) (implementation.ProtoMsg, []byte, error) { impl, err := k.getImplementation(accountType) if err != nil { return nil, nil, err @@ -153,7 +155,7 @@ func (k Keeper) Init( } // make the context and init the account - ctx = k.makeAccountContext(ctx, accountAddr, creator, false) + ctx = k.makeAccountContext(ctx, num, accountAddr, creator, false) resp, err := impl.Init(ctx, initRequest) if err != nil { return nil, nil, err @@ -175,8 +177,8 @@ func (k Keeper) Execute( ctx context.Context, accountAddr []byte, sender []byte, - execRequest any, -) (any, error) { + execRequest implementation.ProtoMsg, +) (implementation.ProtoMsg, error) { // get account type accountType, err := k.AccountsByType.Get(ctx, accountAddr) if err != nil { @@ -192,8 +194,14 @@ func (k Keeper) Execute( return nil, err } + // get account number + accountNum, err := k.AccountByNumber.Get(ctx, accountAddr) + if err != nil { + return nil, err + } + // make the context and execute the account state transition. - ctx = k.makeAccountContext(ctx, accountAddr, sender, false) + ctx = k.makeAccountContext(ctx, accountNum, accountAddr, sender, false) return impl.Execute(ctx, execRequest) } @@ -201,8 +209,8 @@ func (k Keeper) Execute( func (k Keeper) Query( ctx context.Context, accountAddr []byte, - queryRequest any, -) (any, error) { + queryRequest implementation.ProtoMsg, +) (implementation.ProtoMsg, error) { // get account type accountType, err := k.AccountsByType.Get(ctx, accountAddr) if err != nil { @@ -218,8 +226,13 @@ func (k Keeper) Query( return nil, err } + accountNum, err := k.AccountByNumber.Get(ctx, accountAddr) + if err != nil { + return nil, err + } + // make the context and execute the account query - ctx = k.makeAccountContext(ctx, accountAddr, nil, true) + ctx = k.makeAccountContext(ctx, accountNum, accountAddr, nil, true) return impl.Query(ctx, queryRequest) } @@ -238,12 +251,13 @@ func (k Keeper) makeAddress(accNum uint64) ([]byte, error) { } // makeAccountContext makes a new context for the given account. -func (k Keeper) makeAccountContext(ctx context.Context, accountAddr, sender []byte, isQuery bool) context.Context { +func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, accountAddr, sender []byte, isQuery bool) context.Context { // if it's not a query we create a context that allows to do anything. if !isQuery { return implementation.MakeAccountContext( ctx, k.storeService, + accountNumber, accountAddr, sender, k.sendModuleMessage, @@ -257,24 +271,25 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountAddr, sender []by return implementation.MakeAccountContext( ctx, k.storeService, + accountNumber, accountAddr, nil, - func(ctx context.Context, sender []byte, msg, msgResp proto.Message) error { + func(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { return fmt.Errorf("cannot execute in query context") }, - func(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error) { + func(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { return nil, fmt.Errorf("cannot execute in query context") }, k.queryModule, ) } -// sendAnyMessages it a helper function that executes untyped anypb.Any messages +// sendAnyMessages it a helper function that executes untyped codectypes.Any messages // The messages must all belong to a module. -func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages []*anypb.Any) ([]*anypb.Any, error) { - anyResponses := make([]*anypb.Any, len(anyMessages)) +func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages []*implementation.Any) ([]*implementation.Any, error) { + anyResponses := make([]*implementation.Any, len(anyMessages)) for i := range anyMessages { - msg, err := anyMessages[i].UnmarshalNew() + msg, err := implementation.UnpackAnyRaw(anyMessages[i]) if err != nil { return nil, err } @@ -293,19 +308,18 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages // sendModuleMessageUntyped can be used to send a message towards a module. // It should be used when the response type is not known by the caller. -func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error) { +func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { // we need to fetch the response type from the request message type. // this is because the response type is not known. - respName := k.msgRouter.ResponseNameByRequestName(string(msg.ProtoReflect().Descriptor().FullName())) + respName := k.msgRouter.ResponseNameByRequestName(implementation.MessageName(msg)) if respName == "" { return nil, fmt.Errorf("could not find response type for message %T", msg) } // get response type - respType, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(respName)) + resp, err := implementation.FindMessageByName(respName) if err != nil { return nil, err } - resp := respType.New().Interface() // send the message return resp, k.sendModuleMessage(ctx, sender, msg, resp) } @@ -313,9 +327,9 @@ func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg // sendModuleMessage can be used to send a message towards a module. It expects the // response type to be known by the caller. It will also assert the sender has the right // is not trying to impersonate another account. -func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgResp proto.Message) error { +func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { // do sender assertions. - wantSenders, err := k.signerProvider.GetSigners(msg) + wantSenders, _, err := k.signerProvider.GetMsgV1Signers(msg) if err != nil { return fmt.Errorf("cannot get signers: %w", err) } @@ -325,21 +339,19 @@ func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgRe if !bytes.Equal(sender, wantSenders[0]) { return fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized) } - msgV1, msgRespV1 := msg.(protoiface.MessageV1), msgResp.(protoiface.MessageV1) - messageName := getMessageName(msgV1) + messageName := implementation.MessageName(msg) handler := k.msgRouter.HybridHandlerByMsgName(messageName) if handler == nil { return fmt.Errorf("unknown message: %s", messageName) } - return handler(ctx, msgV1, msgRespV1) + return handler(ctx, msg, msgResp) } // queryModule is the entrypoint for an account to query a module. // It will try to find the query handler for the given query and execute it. // If multiple query handlers are found, it will return an error. -func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp proto.Message) error { - queryReqV1, queryRespV1 := queryReq.(protoiface.MessageV1), queryResp.(protoiface.MessageV1) - queryName := getMessageName(queryReqV1) +func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp implementation.ProtoMsg) error { + queryName := implementation.MessageName(queryReq) handlers := k.queryRouter.HybridHandlerByRequestName(queryName) if len(handlers) == 0 { return fmt.Errorf("unknown query: %s", queryName) @@ -347,9 +359,32 @@ func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp proto.Messa if len(handlers) > 1 { return fmt.Errorf("multiple handlers for query: %s", queryName) } - return handlers[0](ctx, queryReqV1, queryRespV1) + return handlers[0](ctx, queryReq, queryResp) } -func getMessageName(msg protoiface.MessageV1) string { - return codectypes.MsgTypeURL(msg)[1:] +const msgInterfaceName = "cosmos.accounts.v1.MsgInterface" + +// creates a new interface type which is an alias of the proto message interface to avoid conflicts with sdk.Msg +type msgInterface implementation.ProtoMsg + +var msgInterfaceType = (*msgInterface)(nil) + +// registerToInterfaceRegistry registers all the interfaces of the accounts to the +// global interface registry. This is required for the SDK to correctly decode +// the google.Protobuf.Any used in x/accounts. +func registerToInterfaceRegistry(ir InterfaceRegistry, accMap map[string]implementation.Implementation) { + ir.RegisterInterface(msgInterfaceName, msgInterfaceType) + + for _, acc := range accMap { + // register init + ir.RegisterImplementations(msgInterfaceType, acc.InitHandlerSchema.RequestSchema.New(), acc.InitHandlerSchema.ResponseSchema.New()) + // register exec + for _, exec := range acc.ExecuteHandlersSchema { + ir.RegisterImplementations(msgInterfaceType, exec.RequestSchema.New(), exec.ResponseSchema.New()) + } + // register query + for _, query := range acc.QueryHandlersSchema { + ir.RegisterImplementations(msgInterfaceType, query.RequestSchema.New(), query.ResponseSchema.New()) + } + } } diff --git a/x/accounts/keeper_account_abstraction.go b/x/accounts/keeper_account_abstraction.go index 5971a24fc5a2..88b1f1da7351 100644 --- a/x/accounts/keeper_account_abstraction.go +++ b/x/accounts/keeper_account_abstraction.go @@ -5,11 +5,9 @@ import ( "errors" "fmt" - "google.golang.org/protobuf/types/known/anypb" - - account_abstractionv1 "cosmossdk.io/api/cosmos/accounts/interfaces/account_abstraction/v1" - accountsv1 "cosmossdk.io/api/cosmos/accounts/v1" + account_abstractionv1 "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1" "cosmossdk.io/x/accounts/internal/implementation" + v1 "cosmossdk.io/x/accounts/v1" ) var ( @@ -25,9 +23,9 @@ var ( func (k Keeper) ExecuteUserOperation( ctx context.Context, bundler string, - op *accountsv1.UserOperation, -) *accountsv1.UserOperationResponse { - resp := &accountsv1.UserOperationResponse{} + op *v1.UserOperation, +) *v1.UserOperationResponse { + resp := &v1.UserOperationResponse{} // authenticate authGas, err := k.Authenticate(ctx, bundler, op) @@ -66,7 +64,7 @@ func (k Keeper) ExecuteUserOperation( func (k Keeper) Authenticate( ctx context.Context, bundler string, - op *accountsv1.UserOperation, + op *v1.UserOperation, ) (gasUsed uint64, err error) { // authenticate gasUsed, err = k.branchExecutor.ExecuteWithGasLimit(ctx, op.AuthenticationGasLimit, func(ctx context.Context) error { @@ -82,7 +80,7 @@ func (k Keeper) Authenticate( func (k Keeper) authenticate( ctx context.Context, bundler string, - op *accountsv1.UserOperation, + op *v1.UserOperation, ) error { senderAddr, err := k.addressCodec.StringToBytes(op.Sender) if err != nil { @@ -106,8 +104,8 @@ func (k Keeper) authenticate( func (k Keeper) OpExecuteMessages( ctx context.Context, bundler string, - op *accountsv1.UserOperation, -) (gasUsed uint64, responses []*anypb.Any, err error) { + op *v1.UserOperation, +) (gasUsed uint64, responses []*implementation.Any, err error) { // execute messages, the real operation intent gasUsed, err = k.branchExecutor.ExecuteWithGasLimit(ctx, op.ExecutionGasLimit, func(ctx context.Context) error { responses, err = k.opExecuteMessages(ctx, bundler, op) @@ -122,8 +120,8 @@ func (k Keeper) OpExecuteMessages( func (k Keeper) opExecuteMessages( ctx context.Context, bundler string, - op *accountsv1.UserOperation, -) (messagesResponse []*anypb.Any, err error) { + op *v1.UserOperation, +) (messagesResponse []*implementation.Any, err error) { senderAddr, err := k.addressCodec.StringToBytes(op.Sender) if err != nil { return nil, err @@ -159,8 +157,8 @@ func (k Keeper) opExecuteMessages( func (k Keeper) PayBundler( ctx context.Context, bundler string, - op *accountsv1.UserOperation, -) (gasUsed uint64, responses []*anypb.Any, err error) { + op *v1.UserOperation, +) (gasUsed uint64, responses []*implementation.Any, err error) { // pay bundler gasUsed, err = k.branchExecutor.ExecuteWithGasLimit(ctx, op.BundlerPaymentGasLimit, func(ctx context.Context) error { responses, err = k.payBundler(ctx, bundler, op) @@ -175,8 +173,8 @@ func (k Keeper) PayBundler( func (k Keeper) payBundler( ctx context.Context, bundler string, - op *accountsv1.UserOperation, -) (paymentResponses []*anypb.Any, err error) { + op *v1.UserOperation, +) (paymentResponses []*implementation.Any, err error) { // if messages are empty, then there is nothing to do if len(op.BundlerPaymentMessages) == 0 { return nil, nil @@ -209,7 +207,7 @@ func (k Keeper) payBundler( // parsePayBundlerResponse parses the bundler response as any into a slice of // responses on payment messages. -func parsePayBundlerResponse(resp any) ([]*anypb.Any, error) { +func parsePayBundlerResponse(resp any) ([]*implementation.Any, error) { payBundlerResp, ok := resp.(*account_abstractionv1.MsgPayBundlerResponse) // this means the account does not properly implement account abstraction. if payBundlerResp == nil { @@ -223,7 +221,7 @@ func parsePayBundlerResponse(resp any) ([]*anypb.Any, error) { // parseExecuteResponse parses the execute response as any into a slice of // responses on execution messages. -func parseExecuteResponse(resp any) ([]*anypb.Any, error) { +func parseExecuteResponse(resp any) ([]*implementation.Any, error) { executeResp, ok := resp.(*account_abstractionv1.MsgExecuteResponse) // this means the account does not properly implement account abstraction. if executeResp == nil { diff --git a/x/accounts/keeper_test.go b/x/accounts/keeper_test.go index 6535d99a9783..baf3f7250def 100644 --- a/x/accounts/keeper_test.go +++ b/x/accounts/keeper_test.go @@ -4,20 +4,20 @@ import ( "context" "testing" + "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/emptypb" - "google.golang.org/protobuf/types/known/wrapperspb" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" "cosmossdk.io/collections" "cosmossdk.io/x/accounts/accountstd" + "cosmossdk.io/x/accounts/internal/implementation" ) func TestKeeper_Init(t *testing.T) { m, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount)) - m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { + m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { _, ok := req.(*bankv1beta1.QueryBalanceRequest) require.True(t, ok) _, ok = resp.(*bankv1beta1.QueryBalanceResponse) @@ -28,9 +28,9 @@ func TestKeeper_Init(t *testing.T) { t.Run("ok", func(t *testing.T) { sender := []byte("sender") - resp, addr, err := m.Init(ctx, "test", sender, &emptypb.Empty{}) + resp, addr, err := m.Init(ctx, "test", sender, &types.Empty{}) require.NoError(t, err) - require.Equal(t, &emptypb.Empty{}, resp) + require.Equal(t, &types.Empty{}, resp) require.NotNil(t, addr) // ensure acc number was increased. @@ -45,33 +45,33 @@ func TestKeeper_Init(t *testing.T) { }) t.Run("unknown account type", func(t *testing.T) { - _, _, err := m.Init(ctx, "unknown", []byte("sender"), &emptypb.Empty{}) + _, _, err := m.Init(ctx, "unknown", []byte("sender"), &types.Empty{}) require.ErrorIs(t, err, errAccountTypeNotFound) }) } func TestKeeper_Execute(t *testing.T) { m, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount)) - m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { return nil }) + m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { return nil }) // create account sender := []byte("sender") - _, accAddr, err := m.Init(ctx, "test", sender, &emptypb.Empty{}) + _, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{}) require.NoError(t, err) t.Run("ok", func(t *testing.T) { - resp, err := m.Execute(ctx, accAddr, sender, &emptypb.Empty{}) + resp, err := m.Execute(ctx, accAddr, sender, &types.Empty{}) require.NoError(t, err) - require.Equal(t, &emptypb.Empty{}, resp) + require.Equal(t, &types.Empty{}, resp) }) t.Run("unknown account", func(t *testing.T) { - _, err := m.Execute(ctx, []byte("unknown"), sender, &emptypb.Empty{}) + _, err := m.Execute(ctx, []byte("unknown"), sender, &types.Empty{}) require.ErrorIs(t, err, collections.ErrNotFound) }) t.Run("exec module", func(t *testing.T) { - m.msgRouter = mockExec(func(ctx context.Context, msg, msgResp proto.Message) error { + m.msgRouter = mockExec(func(ctx context.Context, msg, msgResp implementation.ProtoMsg) error { concrete, ok := msg.(*bankv1beta1.MsgSend) require.True(t, ok) require.Equal(t, concrete.ToAddress, "recipient") @@ -80,43 +80,43 @@ func TestKeeper_Execute(t *testing.T) { return nil }) - m.signerProvider = mockSigner(func(msg proto.Message) ([]byte, error) { + m.signerProvider = mockSigner(func(msg implementation.ProtoMsg) ([]byte, error) { require.Equal(t, msg.(*bankv1beta1.MsgSend).FromAddress, string(accAddr)) return accAddr, nil }) - resp, err := m.Execute(ctx, accAddr, sender, &wrapperspb.Int64Value{Value: 1000}) + resp, err := m.Execute(ctx, accAddr, sender, &types.Int64Value{Value: 1000}) require.NoError(t, err) - require.True(t, proto.Equal(&emptypb.Empty{}, resp.(proto.Message))) + require.True(t, implementation.Equal(&types.Empty{}, resp)) }) } func TestKeeper_Query(t *testing.T) { m, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount)) - m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { + m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { return nil }) // create account sender := []byte("sender") - _, accAddr, err := m.Init(ctx, "test", sender, &emptypb.Empty{}) + _, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{}) require.NoError(t, err) t.Run("ok", func(t *testing.T) { - resp, err := m.Query(ctx, accAddr, &emptypb.Empty{}) + resp, err := m.Query(ctx, accAddr, &types.Empty{}) require.NoError(t, err) - require.Equal(t, &emptypb.Empty{}, resp) + require.Equal(t, &types.Empty{}, resp) }) t.Run("unknown account", func(t *testing.T) { - _, err := m.Query(ctx, []byte("unknown"), &emptypb.Empty{}) + _, err := m.Query(ctx, []byte("unknown"), &types.Empty{}) require.ErrorIs(t, err, collections.ErrNotFound) }) t.Run("query module", func(t *testing.T) { // we inject the module query function, which accepts only a specific type of message // we force the response - m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { + m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { concrete, ok := req.(*bankv1beta1.QueryBalanceRequest) require.True(t, ok) require.Equal(t, string(accAddr), concrete.Address) @@ -125,12 +125,12 @@ func TestKeeper_Query(t *testing.T) { Denom: "atom", Amount: "1000", }} - proto.Merge(resp, copyResp) + proto.Merge(resp.(proto.Message), copyResp) return nil }) - resp, err := m.Query(ctx, accAddr, wrapperspb.String("atom")) + resp, err := m.Query(ctx, accAddr, &types.StringValue{Value: "atom"}) require.NoError(t, err) - require.True(t, proto.Equal(wrapperspb.Int64(1000), resp.(proto.Message))) + require.True(t, implementation.Equal(&types.Int64Value{Value: 1000}, resp)) }) } diff --git a/x/accounts/msg_server.go b/x/accounts/msg_server.go index 04cf4963c42e..20357ba3e27b 100644 --- a/x/accounts/msg_server.go +++ b/x/accounts/msg_server.go @@ -7,6 +7,7 @@ import ( "google.golang.org/grpc/status" "cosmossdk.io/core/event" + "cosmossdk.io/x/accounts/internal/implementation" v1 "cosmossdk.io/x/accounts/v1" ) @@ -26,13 +27,8 @@ func (m msgServer) Init(ctx context.Context, request *v1.MsgInit) (*v1.MsgInitRe return nil, err } - impl, err := m.k.getImplementation(request.AccountType) - if err != nil { - return nil, err - } - // decode message bytes into the concrete boxed message type - msg, err := impl.InitHandlerSchema.RequestSchema.TxDecode(request.Message) + msg, err := implementation.UnpackAnyRaw(request.Message) if err != nil { return nil, err } @@ -43,12 +39,6 @@ func (m msgServer) Init(ctx context.Context, request *v1.MsgInit) (*v1.MsgInitRe return nil, err } - // encode the response - respBytes, err := impl.InitHandlerSchema.ResponseSchema.TxEncode(resp) - if err != nil { - return nil, err - } - // encode the address accAddrString, err := m.k.addressCodec.BytesToString(accAddr) if err != nil { @@ -67,9 +57,14 @@ func (m msgServer) Init(ctx context.Context, request *v1.MsgInit) (*v1.MsgInitRe if err != nil { return nil, err } + + anyResp, err := implementation.PackAny(resp) + if err != nil { + return nil, err + } return &v1.MsgInitResponse{ AccountAddress: accAddrString, - Response: respBytes, + Response: anyResp, }, nil } @@ -85,20 +80,8 @@ func (m msgServer) Execute(ctx context.Context, execute *v1.MsgExecute) (*v1.Msg return nil, err } - // get account type - accType, err := m.k.AccountsByType.Get(ctx, targetAddr) - if err != nil { - return nil, err - } - - // get the implementation - impl, err := m.k.getImplementation(accType) - if err != nil { - return nil, err - } - // decode message bytes into the concrete boxed message type - req, err := impl.DecodeExecuteRequest(execute.Message) + req, err := implementation.UnpackAnyRaw(execute.Message) if err != nil { return nil, err } @@ -110,13 +93,12 @@ func (m msgServer) Execute(ctx context.Context, execute *v1.MsgExecute) (*v1.Msg } // encode the response - respBytes, err := impl.EncodeExecuteResponse(resp) + respAny, err := implementation.PackAny(resp) if err != nil { return nil, err } - return &v1.MsgExecuteResponse{ - Response: respBytes, + Response: respAny, }, nil } diff --git a/x/accounts/msg_server_test.go b/x/accounts/msg_server_test.go index a55536b900a4..1b96e415247c 100644 --- a/x/accounts/msg_server_test.go +++ b/x/accounts/msg_server_test.go @@ -6,28 +6,28 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/wrapperspb" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" "cosmossdk.io/x/accounts/accountstd" + "cosmossdk.io/x/accounts/internal/implementation" v1 "cosmossdk.io/x/accounts/v1" ) func TestMsgServer(t *testing.T) { k, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount)) - k.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { + k.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { _, ok := req.(*bankv1beta1.QueryBalanceRequest) require.True(t, ok) - proto.Merge(resp, &bankv1beta1.QueryBalanceResponse{}) + proto.Merge(resp.(proto.Message), &bankv1beta1.QueryBalanceResponse{}) return nil }) s := NewMsgServer(k) // create - initMsg, err := proto.Marshal(&emptypb.Empty{}) + initMsg, err := implementation.PackAny(&emptypb.Empty{}) require.NoError(t, err) initResp, err := s.Init(ctx, &v1.MsgInit{ @@ -42,16 +42,13 @@ func TestMsgServer(t *testing.T) { executeMsg := &wrapperspb.StringValue{ Value: "10", } - executeMsgAny, err := anypb.New(executeMsg) - require.NoError(t, err) - - executeMsgBytes, err := proto.Marshal(executeMsgAny) + executeMsgAny, err := implementation.PackAny(executeMsg) require.NoError(t, err) execResp, err := s.Execute(ctx, &v1.MsgExecute{ Sender: "sender", Target: initResp.AccountAddress, - Message: executeMsgBytes, + Message: executeMsgAny, }) require.NoError(t, err) require.NotNil(t, execResp) diff --git a/x/accounts/query_server.go b/x/accounts/query_server.go index ac05596e1f7f..cd5930fa808a 100644 --- a/x/accounts/query_server.go +++ b/x/accounts/query_server.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "cosmossdk.io/x/accounts/internal/implementation" v1 "cosmossdk.io/x/accounts/v1" ) @@ -24,20 +25,8 @@ func (q queryServer) AccountQuery(ctx context.Context, request *v1.AccountQueryR return nil, err } - // get acc type - accType, err := q.k.AccountsByType.Get(ctx, targetAddr) - if err != nil { - return nil, err - } - - // get impl - impl, err := q.k.getImplementation(accType) - if err != nil { - return nil, err - } - // decode req into boxed concrete type - queryReq, err := impl.DecodeQueryRequest(request.Request) + queryReq, err := implementation.UnpackAnyRaw(request.Request) if err != nil { return nil, err } @@ -48,13 +37,13 @@ func (q queryServer) AccountQuery(ctx context.Context, request *v1.AccountQueryR } // encode response - respBytes, err := impl.EncodeQueryResponse(resp) + respAny, err := implementation.PackAny(resp) if err != nil { return nil, err } return &v1.AccountQueryResponse{ - Response: respBytes, + Response: respAny, }, nil } diff --git a/x/accounts/query_server_test.go b/x/accounts/query_server_test.go index 6b091918cede..6ff2ee30bcc3 100644 --- a/x/accounts/query_server_test.go +++ b/x/accounts/query_server_test.go @@ -4,19 +4,19 @@ import ( "context" "testing" + "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/wrapperspb" "cosmossdk.io/x/accounts/accountstd" + "cosmossdk.io/x/accounts/internal/implementation" v1 "cosmossdk.io/x/accounts/v1" ) func TestQueryServer(t *testing.T) { k, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount)) - k.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { + k.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { return nil }) @@ -24,7 +24,7 @@ func TestQueryServer(t *testing.T) { qs := NewQueryServer(k) // create - initMsg, err := proto.Marshal(&emptypb.Empty{}) + initMsg, err := implementation.PackAny(&emptypb.Empty{}) require.NoError(t, err) initResp, err := ms.Init(ctx, &v1.MsgInit{ @@ -36,24 +36,17 @@ func TestQueryServer(t *testing.T) { // query req := &wrapperspb.UInt64Value{Value: 10} - anypbReq, err := anypb.New(req) - require.NoError(t, err) - - anypbReqBytes, err := proto.Marshal(anypbReq) + anypbReq, err := implementation.PackAny(req) require.NoError(t, err) queryResp, err := qs.AccountQuery(ctx, &v1.AccountQueryRequest{ Target: initResp.AccountAddress, - Request: anypbReqBytes, + Request: anypbReq, }) require.NoError(t, err) - respAnyPB := &anypb.Any{} - err = proto.Unmarshal(queryResp.Response, respAnyPB) - require.NoError(t, err) - - resp, err := respAnyPB.UnmarshalNew() + resp, err := implementation.UnpackAnyRaw(queryResp.Response) require.NoError(t, err) - require.Equal(t, "10", resp.(*wrapperspb.StringValue).Value) + require.Equal(t, "10", resp.(*types.StringValue).Value) } diff --git a/x/accounts/testing/account_abstraction/full.go b/x/accounts/testing/account_abstraction/full.go index 64d61874770f..e4f08fbc5d9a 100644 --- a/x/accounts/testing/account_abstraction/full.go +++ b/x/accounts/testing/account_abstraction/full.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - account_abstractionv1 "cosmossdk.io/api/cosmos/accounts/interfaces/account_abstraction/v1" "cosmossdk.io/x/accounts/accountstd" + account_abstractionv1 "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1" ) // FullAbstractedAccount is an account abstraction that implements diff --git a/x/accounts/testing/account_abstraction/minimal.go b/x/accounts/testing/account_abstraction/minimal.go index 7be41619f6be..3a194370d1d3 100644 --- a/x/accounts/testing/account_abstraction/minimal.go +++ b/x/accounts/testing/account_abstraction/minimal.go @@ -4,11 +4,11 @@ import ( "context" "fmt" - account_abstractionv1 "cosmossdk.io/api/cosmos/accounts/interfaces/account_abstraction/v1" - rotationv1 "cosmossdk.io/api/cosmos/accounts/testing/rotation/v1" "cosmossdk.io/api/cosmos/crypto/secp256k1" "cosmossdk.io/collections" "cosmossdk.io/x/accounts/accountstd" + account_abstractionv1 "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1" + rotationv1 "cosmossdk.io/x/accounts/testing/rotation/v1" "github.com/cosmos/cosmos-sdk/codec" ) diff --git a/x/accounts/testing/counter/counter.go b/x/accounts/testing/counter/counter.go index 8e83d18a6e7c..7e6acf0b826d 100644 --- a/x/accounts/testing/counter/counter.go +++ b/x/accounts/testing/counter/counter.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - counterv1 "cosmossdk.io/api/cosmos/accounts/testing/counter/v1" "cosmossdk.io/collections" "cosmossdk.io/x/accounts/accountstd" + counterv1 "cosmossdk.io/x/accounts/testing/counter/v1" ) var ( diff --git a/x/accounts/testing/counter/v1/counter.pb.go b/x/accounts/testing/counter/v1/counter.pb.go new file mode 100644 index 000000000000..cf9f06c5ef9a --- /dev/null +++ b/x/accounts/testing/counter/v1/counter.pb.go @@ -0,0 +1,1018 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/accounts/testing/counter/v1/counter.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgInit defines a message which initializes the counter with a given amount. +type MsgInit struct { + // initial_value is the initial amount to set the counter to. + InitialValue uint64 `protobuf:"varint,1,opt,name=initial_value,json=initialValue,proto3" json:"initial_value,omitempty"` +} + +func (m *MsgInit) Reset() { *m = MsgInit{} } +func (m *MsgInit) String() string { return proto.CompactTextString(m) } +func (*MsgInit) ProtoMessage() {} +func (*MsgInit) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{0} +} +func (m *MsgInit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgInit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInit.Merge(m, src) +} +func (m *MsgInit) XXX_Size() int { + return m.Size() +} +func (m *MsgInit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInit proto.InternalMessageInfo + +func (m *MsgInit) GetInitialValue() uint64 { + if m != nil { + return m.InitialValue + } + return 0 +} + +// MsgInitResponse defines the MsgInit response type. +type MsgInitResponse struct { +} + +func (m *MsgInitResponse) Reset() { *m = MsgInitResponse{} } +func (m *MsgInitResponse) String() string { return proto.CompactTextString(m) } +func (*MsgInitResponse) ProtoMessage() {} +func (*MsgInitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{1} +} +func (m *MsgInitResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInitResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgInitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInitResponse.Merge(m, src) +} +func (m *MsgInitResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgInitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInitResponse proto.InternalMessageInfo + +// MsgIncreaseCounter defines a message which increases the counter by a given amount. +type MsgIncreaseCounter struct { + // amount is the amount to increase the counter by. + Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *MsgIncreaseCounter) Reset() { *m = MsgIncreaseCounter{} } +func (m *MsgIncreaseCounter) String() string { return proto.CompactTextString(m) } +func (*MsgIncreaseCounter) ProtoMessage() {} +func (*MsgIncreaseCounter) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{2} +} +func (m *MsgIncreaseCounter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIncreaseCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIncreaseCounter.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgIncreaseCounter) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIncreaseCounter.Merge(m, src) +} +func (m *MsgIncreaseCounter) XXX_Size() int { + return m.Size() +} +func (m *MsgIncreaseCounter) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIncreaseCounter.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIncreaseCounter proto.InternalMessageInfo + +func (m *MsgIncreaseCounter) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +// MsgIncreaseCounterResponse defines the MsgIncreaseCounter response type. +// Returns the new counter value. +type MsgIncreaseCounterResponse struct { + // new_amount defines the new counter value after the increase. + NewAmount uint64 `protobuf:"varint,1,opt,name=new_amount,json=newAmount,proto3" json:"new_amount,omitempty"` +} + +func (m *MsgIncreaseCounterResponse) Reset() { *m = MsgIncreaseCounterResponse{} } +func (m *MsgIncreaseCounterResponse) String() string { return proto.CompactTextString(m) } +func (*MsgIncreaseCounterResponse) ProtoMessage() {} +func (*MsgIncreaseCounterResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{3} +} +func (m *MsgIncreaseCounterResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIncreaseCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIncreaseCounterResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgIncreaseCounterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIncreaseCounterResponse.Merge(m, src) +} +func (m *MsgIncreaseCounterResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgIncreaseCounterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIncreaseCounterResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIncreaseCounterResponse proto.InternalMessageInfo + +func (m *MsgIncreaseCounterResponse) GetNewAmount() uint64 { + if m != nil { + return m.NewAmount + } + return 0 +} + +// QueryCounterRequest is used to query the counter value. +type QueryCounterRequest struct { +} + +func (m *QueryCounterRequest) Reset() { *m = QueryCounterRequest{} } +func (m *QueryCounterRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCounterRequest) ProtoMessage() {} +func (*QueryCounterRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{4} +} +func (m *QueryCounterRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCounterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCounterRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryCounterRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCounterRequest.Merge(m, src) +} +func (m *QueryCounterRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCounterRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCounterRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCounterRequest proto.InternalMessageInfo + +// QueryCounterResponse returns the counter value. +type QueryCounterResponse struct { + // value defines the value of the counter. + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *QueryCounterResponse) Reset() { *m = QueryCounterResponse{} } +func (m *QueryCounterResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCounterResponse) ProtoMessage() {} +func (*QueryCounterResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{5} +} +func (m *QueryCounterResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCounterResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryCounterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCounterResponse.Merge(m, src) +} +func (m *QueryCounterResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCounterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCounterResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCounterResponse proto.InternalMessageInfo + +func (m *QueryCounterResponse) GetValue() uint64 { + if m != nil { + return m.Value + } + return 0 +} + +func init() { + proto.RegisterType((*MsgInit)(nil), "cosmos.accounts.testing.counter.v1.MsgInit") + proto.RegisterType((*MsgInitResponse)(nil), "cosmos.accounts.testing.counter.v1.MsgInitResponse") + proto.RegisterType((*MsgIncreaseCounter)(nil), "cosmos.accounts.testing.counter.v1.MsgIncreaseCounter") + proto.RegisterType((*MsgIncreaseCounterResponse)(nil), "cosmos.accounts.testing.counter.v1.MsgIncreaseCounterResponse") + proto.RegisterType((*QueryCounterRequest)(nil), "cosmos.accounts.testing.counter.v1.QueryCounterRequest") + proto.RegisterType((*QueryCounterResponse)(nil), "cosmos.accounts.testing.counter.v1.QueryCounterResponse") +} + +func init() { + proto.RegisterFile("cosmos/accounts/testing/counter/v1/counter.proto", fileDescriptor_21c9320877186411) +} + +var fileDescriptor_21c9320877186411 = []byte{ + // 264 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, + 0xc9, 0xcc, 0x4b, 0xd7, 0x07, 0x73, 0x53, 0x8b, 0xf4, 0xcb, 0x0c, 0x61, 0x4c, 0xbd, 0x82, 0xa2, + 0xfc, 0x92, 0x7c, 0x21, 0x25, 0x88, 0x0e, 0x3d, 0x98, 0x0e, 0x3d, 0xa8, 0x0e, 0x3d, 0x98, 0xb2, + 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x76, 0xdf, 0xe2, 0x74, 0xcf, 0xbc, 0xcc, 0x12, 0x21, 0x65, 0x2e, + 0xde, 0xcc, 0xbc, 0xcc, 0x92, 0xcc, 0xc4, 0x9c, 0xf8, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0x96, 0x20, 0x1e, 0xa8, 0x60, 0x18, 0x48, 0x4c, 0x49, 0x90, 0x8b, 0x1f, 0xaa, + 0x3e, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x49, 0x87, 0x4b, 0x08, 0x2c, 0x94, 0x5c, + 0x94, 0x9a, 0x58, 0x9c, 0xea, 0x0c, 0x31, 0x5b, 0x48, 0x8c, 0x8b, 0x2d, 0x31, 0x17, 0xc4, 0x86, + 0x1a, 0x03, 0xe5, 0x29, 0x59, 0x73, 0x49, 0x61, 0xaa, 0x86, 0x99, 0x25, 0x24, 0xcb, 0xc5, 0x95, + 0x97, 0x5a, 0x1e, 0x8f, 0xa2, 0x93, 0x33, 0x2f, 0xb5, 0xdc, 0x11, 0xa2, 0x59, 0x94, 0x4b, 0x38, + 0xb0, 0x34, 0xb5, 0xa8, 0x12, 0xae, 0xad, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x49, 0x87, 0x4b, 0x04, + 0x55, 0x18, 0x6a, 0x9a, 0x08, 0x17, 0x2b, 0xb2, 0x4f, 0x20, 0x1c, 0x27, 0x97, 0x13, 0x8f, 0xe4, + 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, + 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x82, 0x04, 0x58, 0x71, 0x4a, 0xb6, 0x5e, 0x66, + 0xbe, 0x7e, 0x05, 0xbe, 0xa0, 0x4e, 0x62, 0x03, 0x87, 0xb1, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, + 0x5e, 0xe6, 0x3d, 0x27, 0x97, 0x01, 0x00, 0x00, +} + +func (m *MsgInit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InitialValue != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.InitialValue)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgInitResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgInitResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgIncreaseCounter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgIncreaseCounter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIncreaseCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgIncreaseCounterResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgIncreaseCounterResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIncreaseCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NewAmount != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.NewAmount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCounterRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryCounterRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCounterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryCounterResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryCounterResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintCounter(dAtA []byte, offset int, v uint64) int { + offset -= sovCounter(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.InitialValue != 0 { + n += 1 + sovCounter(uint64(m.InitialValue)) + } + return n +} + +func (m *MsgInitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgIncreaseCounter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Amount != 0 { + n += 1 + sovCounter(uint64(m.Amount)) + } + return n +} + +func (m *MsgIncreaseCounterResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NewAmount != 0 { + n += 1 + sovCounter(uint64(m.NewAmount)) + } + return n +} + +func (m *QueryCounterRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryCounterResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovCounter(uint64(m.Value)) + } + return n +} + +func sovCounter(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCounter(x uint64) (n int) { + return sovCounter(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgInit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgInit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialValue", wireType) + } + m.InitialValue = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialValue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgInitResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgInitResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgIncreaseCounter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgIncreaseCounter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIncreaseCounter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgIncreaseCounterResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgIncreaseCounterResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIncreaseCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewAmount", wireType) + } + m.NewAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NewAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCounterRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCounterRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCounterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCounterResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCounterResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCounter(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCounter + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCounter + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCounter + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthCounter + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCounter + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCounter + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCounter = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCounter = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCounter = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/accounts/testing/rotation/v1/partial.pb.go b/x/accounts/testing/rotation/v1/partial.pb.go new file mode 100644 index 000000000000..52a71ffd11df --- /dev/null +++ b/x/accounts/testing/rotation/v1/partial.pb.go @@ -0,0 +1,740 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/accounts/testing/rotation/v1/partial.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgInit is the init message used to create a new account +// abstraction implementation that we use for testing, this account +// also allows for rotating the public key. +type MsgInit struct { + PubKeyBytes []byte `protobuf:"bytes,1,opt,name=pub_key_bytes,json=pubKeyBytes,proto3" json:"pub_key_bytes,omitempty"` +} + +func (m *MsgInit) Reset() { *m = MsgInit{} } +func (m *MsgInit) String() string { return proto.CompactTextString(m) } +func (*MsgInit) ProtoMessage() {} +func (*MsgInit) Descriptor() ([]byte, []int) { + return fileDescriptor_825607d6750dcaf0, []int{0} +} +func (m *MsgInit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgInit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInit.Merge(m, src) +} +func (m *MsgInit) XXX_Size() int { + return m.Size() +} +func (m *MsgInit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInit proto.InternalMessageInfo + +func (m *MsgInit) GetPubKeyBytes() []byte { + if m != nil { + return m.PubKeyBytes + } + return nil +} + +// MsgInitResponse is the init message response. +type MsgInitResponse struct { +} + +func (m *MsgInitResponse) Reset() { *m = MsgInitResponse{} } +func (m *MsgInitResponse) String() string { return proto.CompactTextString(m) } +func (*MsgInitResponse) ProtoMessage() {} +func (*MsgInitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_825607d6750dcaf0, []int{1} +} +func (m *MsgInitResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInitResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgInitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInitResponse.Merge(m, src) +} +func (m *MsgInitResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgInitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInitResponse proto.InternalMessageInfo + +// MsgRotatePubKey is the message used to swap the public key +// of the account. +type MsgRotatePubKey struct { + NewPubKeyBytes []byte `protobuf:"bytes,1,opt,name=new_pub_key_bytes,json=newPubKeyBytes,proto3" json:"new_pub_key_bytes,omitempty"` +} + +func (m *MsgRotatePubKey) Reset() { *m = MsgRotatePubKey{} } +func (m *MsgRotatePubKey) String() string { return proto.CompactTextString(m) } +func (*MsgRotatePubKey) ProtoMessage() {} +func (*MsgRotatePubKey) Descriptor() ([]byte, []int) { + return fileDescriptor_825607d6750dcaf0, []int{2} +} +func (m *MsgRotatePubKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRotatePubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRotatePubKey.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRotatePubKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRotatePubKey.Merge(m, src) +} +func (m *MsgRotatePubKey) XXX_Size() int { + return m.Size() +} +func (m *MsgRotatePubKey) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRotatePubKey.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRotatePubKey proto.InternalMessageInfo + +func (m *MsgRotatePubKey) GetNewPubKeyBytes() []byte { + if m != nil { + return m.NewPubKeyBytes + } + return nil +} + +// MsgRotatePubKeyResponse is the MsgRotatePubKey response. +type MsgRotatePubKeyResponse struct { +} + +func (m *MsgRotatePubKeyResponse) Reset() { *m = MsgRotatePubKeyResponse{} } +func (m *MsgRotatePubKeyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRotatePubKeyResponse) ProtoMessage() {} +func (*MsgRotatePubKeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_825607d6750dcaf0, []int{3} +} +func (m *MsgRotatePubKeyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRotatePubKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRotatePubKeyResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRotatePubKeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRotatePubKeyResponse.Merge(m, src) +} +func (m *MsgRotatePubKeyResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRotatePubKeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRotatePubKeyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRotatePubKeyResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgInit)(nil), "cosmos.accounts.testing.rotation.v1.MsgInit") + proto.RegisterType((*MsgInitResponse)(nil), "cosmos.accounts.testing.rotation.v1.MsgInitResponse") + proto.RegisterType((*MsgRotatePubKey)(nil), "cosmos.accounts.testing.rotation.v1.MsgRotatePubKey") + proto.RegisterType((*MsgRotatePubKeyResponse)(nil), "cosmos.accounts.testing.rotation.v1.MsgRotatePubKeyResponse") +} + +func init() { + proto.RegisterFile("cosmos/accounts/testing/rotation/v1/partial.proto", fileDescriptor_825607d6750dcaf0) +} + +var fileDescriptor_825607d6750dcaf0 = []byte{ + // 234 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, + 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0xca, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, + 0x2f, 0x48, 0x2c, 0x2a, 0xc9, 0x4c, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x86, + 0x68, 0xd1, 0x83, 0x69, 0xd1, 0x83, 0x6a, 0xd1, 0x83, 0x69, 0xd1, 0x2b, 0x33, 0x54, 0xd2, 0xe5, + 0x62, 0xf7, 0x2d, 0x4e, 0xf7, 0xcc, 0xcb, 0x2c, 0x11, 0x52, 0xe2, 0xe2, 0x2d, 0x28, 0x4d, 0x8a, + 0xcf, 0x4e, 0xad, 0x8c, 0x4f, 0xaa, 0x2c, 0x49, 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, + 0xe2, 0x2e, 0x28, 0x4d, 0xf2, 0x4e, 0xad, 0x74, 0x02, 0x09, 0x29, 0x09, 0x72, 0xf1, 0x43, 0x95, + 0x07, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x2a, 0xd9, 0x80, 0x85, 0x82, 0x40, 0x66, 0xa6, + 0x06, 0x80, 0x95, 0x0a, 0x69, 0x72, 0x09, 0xe6, 0xa5, 0x96, 0xc7, 0x63, 0x33, 0x8d, 0x2f, 0x2f, + 0xb5, 0x3c, 0x00, 0xc9, 0x40, 0x49, 0x2e, 0x71, 0x34, 0xdd, 0x30, 0x83, 0x9d, 0x5c, 0x4f, 0x3c, + 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, + 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x1b, 0xe2, 0xb3, 0xe2, 0x94, 0x6c, 0xbd, + 0xcc, 0x7c, 0xfd, 0x0a, 0xbc, 0x81, 0x92, 0xc4, 0x06, 0x0e, 0x0d, 0x63, 0x40, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x81, 0xbb, 0x18, 0xec, 0x42, 0x01, 0x00, 0x00, +} + +func (m *MsgInit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgInit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PubKeyBytes) > 0 { + i -= len(m.PubKeyBytes) + copy(dAtA[i:], m.PubKeyBytes) + i = encodeVarintPartial(dAtA, i, uint64(len(m.PubKeyBytes))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgInitResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgInitResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRotatePubKey) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRotatePubKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRotatePubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NewPubKeyBytes) > 0 { + i -= len(m.NewPubKeyBytes) + copy(dAtA[i:], m.NewPubKeyBytes) + i = encodeVarintPartial(dAtA, i, uint64(len(m.NewPubKeyBytes))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRotatePubKeyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRotatePubKeyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRotatePubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintPartial(dAtA []byte, offset int, v uint64) int { + offset -= sovPartial(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgInit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PubKeyBytes) + if l > 0 { + n += 1 + l + sovPartial(uint64(l)) + } + return n +} + +func (m *MsgInitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRotatePubKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NewPubKeyBytes) + if l > 0 { + n += 1 + l + sovPartial(uint64(l)) + } + return n +} + +func (m *MsgRotatePubKeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovPartial(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPartial(x uint64) (n int) { + return sovPartial(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgInit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPartial + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgInit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKeyBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPartial + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPartial + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPartial + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKeyBytes = append(m.PubKeyBytes[:0], dAtA[iNdEx:postIndex]...) + if m.PubKeyBytes == nil { + m.PubKeyBytes = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPartial(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPartial + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgInitResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPartial + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgInitResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipPartial(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPartial + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRotatePubKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPartial + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRotatePubKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRotatePubKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewPubKeyBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPartial + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPartial + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPartial + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewPubKeyBytes = append(m.NewPubKeyBytes[:0], dAtA[iNdEx:postIndex]...) + if m.NewPubKeyBytes == nil { + m.NewPubKeyBytes = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPartial(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPartial + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRotatePubKeyResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPartial + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRotatePubKeyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRotatePubKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipPartial(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPartial + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPartial(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPartial + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPartial + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPartial + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPartial + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPartial + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPartial + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPartial = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPartial = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPartial = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/accounts/utils_test.go b/x/accounts/utils_test.go index fa8655431ec4..68adc2d94c6e 100644 --- a/x/accounts/utils_test.go +++ b/x/accounts/utils_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + gogoproto "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/runtime/protoiface" @@ -35,43 +36,51 @@ func (e eventService) EmitNonConsensus(ctx context.Context, event protoiface.Mes func (e eventService) EventManager(ctx context.Context) event.Manager { return e } +var _ InterfaceRegistry = (*interfaceRegistry)(nil) + +type interfaceRegistry struct{} + +func (i interfaceRegistry) RegisterInterface(string, any, ...gogoproto.Message) {} + +func (i interfaceRegistry) RegisterImplementations(any, ...gogoproto.Message) {} + func newKeeper(t *testing.T, accounts ...implementation.AccountCreatorFunc) (Keeper, context.Context) { t.Helper() ss, ctx := colltest.MockStore() - m, err := NewKeeper(ss, eventService{}, nil, addressCodec{}, nil, nil, nil, accounts...) + m, err := NewKeeper(ss, eventService{}, nil, addressCodec{}, nil, nil, nil, interfaceRegistry{}, accounts...) require.NoError(t, err) return m, ctx } var _ QueryRouter = (*mockQuery)(nil) -type mockQuery func(ctx context.Context, req, resp proto.Message) error +type mockQuery func(ctx context.Context, req, resp implementation.ProtoMsg) error -func (m mockQuery) HybridHandlerByRequestName(_ string) []func(ctx context.Context, req, resp protoiface.MessageV1) error { +func (m mockQuery) HybridHandlerByRequestName(_ string) []func(ctx context.Context, req, resp implementation.ProtoMsg) error { return []func(ctx context.Context, req, resp protoiface.MessageV1) error{func(ctx context.Context, req, resp protoiface.MessageV1) error { - return m(ctx, req.(proto.Message), resp.(proto.Message)) + return m(ctx, req, resp) }} } var _ SignerProvider = (*mockSigner)(nil) -type mockSigner func(msg proto.Message) ([]byte, error) +type mockSigner func(msg implementation.ProtoMsg) ([]byte, error) -func (m mockSigner) GetSigners(msg proto.Message) ([][]byte, error) { +func (m mockSigner) GetMsgV1Signers(msg gogoproto.Message) ([][]byte, proto.Message, error) { s, err := m(msg) if err != nil { - return nil, err + return nil, nil, err } - return [][]byte{s}, nil + return [][]byte{s}, nil, nil } var _ MsgRouter = (*mockExec)(nil) -type mockExec func(ctx context.Context, msg, msgResp proto.Message) error +type mockExec func(ctx context.Context, msg, msgResp implementation.ProtoMsg) error func (m mockExec) HybridHandlerByMsgName(_ string) func(ctx context.Context, req, resp protoiface.MessageV1) error { return func(ctx context.Context, req, resp protoiface.MessageV1) error { - return m(ctx, req.(proto.Message), resp.(proto.Message)) + return m(ctx, req, resp) } } diff --git a/x/accounts/v1/genesis.pb.go b/x/accounts/v1/genesis.pb.go index 4f7f03c46dac..b06b43e903df 100644 --- a/x/accounts/v1/genesis.pb.go +++ b/x/accounts/v1/genesis.pb.go @@ -83,8 +83,10 @@ type GenesisAccount struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // account_type is the account type of the account. AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` + // account_number is the account number of the account. + AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"` // state is the account state represented as a slice of raw key value byte pairs. - State []*KVPair `protobuf:"bytes,3,rep,name=state,proto3" json:"state,omitempty"` + State []*KVPair `protobuf:"bytes,4,rep,name=state,proto3" json:"state,omitempty"` } func (m *GenesisAccount) Reset() { *m = GenesisAccount{} } @@ -134,6 +136,13 @@ func (m *GenesisAccount) GetAccountType() string { return "" } +func (m *GenesisAccount) GetAccountNumber() uint64 { + if m != nil { + return m.AccountNumber + } + return 0 +} + func (m *GenesisAccount) GetState() []*KVPair { if m != nil { return m.State @@ -205,7 +214,7 @@ func init() { func init() { proto.RegisterFile("cosmos/accounts/v1/genesis.proto", fileDescriptor_409859d32eae9438) } var fileDescriptor_409859d32eae9438 = []byte{ - // 280 bytes of a gzipped FileDescriptorProto + // 285 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xa8, @@ -213,17 +222,17 @@ var fileDescriptor_409859d32eae9438 = []byte{ 0x2c, 0x49, 0x15, 0x52, 0xe5, 0xe2, 0x83, 0x4a, 0xc7, 0xe7, 0x95, 0xe6, 0x26, 0xa5, 0x16, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x04, 0xf1, 0x42, 0x45, 0xfd, 0xc0, 0x82, 0x42, 0x76, 0x5c, 0x1c, 0x30, 0x53, 0x24, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0x94, 0xf4, 0x30, 0x4d, 0xd7, 0x83, 0x1a, - 0xed, 0x08, 0x11, 0x0a, 0x82, 0xeb, 0x51, 0xaa, 0xe7, 0xe2, 0x43, 0x95, 0x13, 0x92, 0xe0, 0x62, - 0x4f, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x06, 0xdb, 0xc8, 0x19, 0x04, 0xe3, 0x0a, 0x29, 0x72, - 0xf1, 0xc0, 0x9c, 0x54, 0x52, 0x59, 0x90, 0x2a, 0xc1, 0x04, 0x96, 0xe6, 0x86, 0x8a, 0x85, 0x54, - 0x16, 0xa4, 0x0a, 0x19, 0x70, 0xb1, 0x16, 0x83, 0x9c, 0x2f, 0xc1, 0x0c, 0x76, 0x8b, 0x14, 0x36, - 0xb7, 0x78, 0x87, 0x05, 0x24, 0x66, 0x16, 0x05, 0x41, 0x14, 0x2a, 0x19, 0x70, 0xb1, 0x41, 0x04, - 0x84, 0x04, 0xb8, 0x98, 0xb3, 0x53, 0x2b, 0xc1, 0x96, 0xf2, 0x04, 0x81, 0x98, 0x42, 0x22, 0x5c, - 0xac, 0x65, 0x89, 0x39, 0xa5, 0x10, 0x9b, 0x78, 0x82, 0x20, 0x1c, 0x27, 0x93, 0x13, 0x8f, 0xe4, - 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, - 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0x82, 0xd8, 0x56, 0x9c, 0x92, 0xad, 0x97, 0x99, - 0xaf, 0x5f, 0x81, 0x1c, 0x03, 0x49, 0x6c, 0xe0, 0xa0, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, - 0x11, 0x08, 0x28, 0x3a, 0x9e, 0x01, 0x00, 0x00, + 0xed, 0x08, 0x11, 0x0a, 0x82, 0xeb, 0x51, 0x5a, 0xc6, 0xc8, 0xc5, 0x87, 0x2a, 0x29, 0x24, 0xc1, + 0xc5, 0x9e, 0x98, 0x92, 0x52, 0x94, 0x5a, 0x5c, 0x0c, 0xb6, 0x92, 0x33, 0x08, 0xc6, 0x15, 0x52, + 0xe4, 0xe2, 0x81, 0xb9, 0xa9, 0xa4, 0xb2, 0x20, 0x55, 0x82, 0x09, 0x2c, 0xcd, 0x0d, 0x15, 0x0b, + 0xa9, 0x2c, 0xc0, 0xe6, 0x6c, 0x66, 0x6c, 0xce, 0x36, 0xe0, 0x62, 0x2d, 0x06, 0x79, 0x53, 0x82, + 0x05, 0xec, 0x66, 0x29, 0x6c, 0x6e, 0xf6, 0x0e, 0x0b, 0x48, 0xcc, 0x2c, 0x0a, 0x82, 0x28, 0x54, + 0x32, 0xe0, 0x62, 0x83, 0x08, 0x08, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, 0x82, 0xdd, 0xc6, 0x13, + 0x04, 0x62, 0x0a, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0x42, 0x1c, 0xc4, 0x13, 0x04, 0xe1, + 0x38, 0x99, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, + 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x14, 0xc4, 0xb6, + 0xe2, 0x94, 0x6c, 0xbd, 0xcc, 0x7c, 0xfd, 0x0a, 0xe4, 0x98, 0x4a, 0x62, 0x03, 0x47, 0x91, 0x31, + 0x20, 0x00, 0x00, 0xff, 0xff, 0x52, 0xae, 0xf2, 0xc5, 0xc6, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -299,9 +308,14 @@ func (m *GenesisAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } + if m.AccountNumber != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.AccountNumber)) + i-- + dAtA[i] = 0x18 + } if len(m.AccountType) > 0 { i -= len(m.AccountType) copy(dAtA[i:], m.AccountType) @@ -399,6 +413,9 @@ func (m *GenesisAccount) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + if m.AccountNumber != 0 { + n += 1 + sovGenesis(uint64(m.AccountNumber)) + } if len(m.State) > 0 { for _, e := range m.State { l = e.Size() @@ -628,6 +645,25 @@ func (m *GenesisAccount) Unmarshal(dAtA []byte) error { m.AccountType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) + } + m.AccountNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } diff --git a/x/accounts/v1/query.pb.go b/x/accounts/v1/query.pb.go index 27e89b235762..5e65ffc45f9a 100644 --- a/x/accounts/v1/query.pb.go +++ b/x/accounts/v1/query.pb.go @@ -6,6 +6,7 @@ package v1 import ( context "context" fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -32,7 +33,7 @@ type AccountQueryRequest struct { // target defines the account to be queried. Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` // request defines the query message being sent to the account. - Request []byte `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` + Request *types.Any `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"` } func (m *AccountQueryRequest) Reset() { *m = AccountQueryRequest{} } @@ -75,7 +76,7 @@ func (m *AccountQueryRequest) GetTarget() string { return "" } -func (m *AccountQueryRequest) GetRequest() []byte { +func (m *AccountQueryRequest) GetRequest() *types.Any { if m != nil { return m.Request } @@ -85,7 +86,7 @@ func (m *AccountQueryRequest) GetRequest() []byte { // AccountQueryResponse is the response type for the Query/AccountQuery RPC method. type AccountQueryResponse struct { // response defines the query response of the account. - Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` + Response *types.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` } func (m *AccountQueryResponse) Reset() { *m = AccountQueryResponse{} } @@ -121,7 +122,7 @@ func (m *AccountQueryResponse) XXX_DiscardUnknown() { var xxx_messageInfo_AccountQueryResponse proto.InternalMessageInfo -func (m *AccountQueryResponse) GetResponse() []byte { +func (m *AccountQueryResponse) GetResponse() *types.Any { if m != nil { return m.Response } @@ -400,34 +401,36 @@ func init() { func init() { proto.RegisterFile("cosmos/accounts/v1/query.proto", fileDescriptor_16ad14c22e3080d2) } var fileDescriptor_16ad14c22e3080d2 = []byte{ - // 420 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0xce, 0xd2, 0x40, - 0x14, 0x6d, 0x4b, 0x04, 0xbd, 0x2d, 0x68, 0x46, 0x63, 0x9a, 0x2e, 0x1a, 0xe8, 0x42, 0x88, 0x8b, - 0x69, 0xa8, 0x2e, 0xdc, 0x19, 0xdc, 0x68, 0xe2, 0x8a, 0xaa, 0x1b, 0x37, 0x58, 0xdb, 0x89, 0x10, - 0xa5, 0x2d, 0x9d, 0x29, 0x81, 0xb7, 0xf0, 0x15, 0x7c, 0x1b, 0x96, 0x2c, 0x5d, 0x7e, 0x81, 0x17, - 0xf9, 0xc2, 0xfc, 0x40, 0xc9, 0x47, 0x68, 0xd8, 0xcd, 0x99, 0x7b, 0xef, 0xb9, 0x73, 0xcf, 0xb9, - 0x03, 0x6e, 0x9c, 0xd1, 0x79, 0x46, 0xfd, 0x28, 0x8e, 0xb3, 0x32, 0x65, 0xd4, 0x5f, 0x0e, 0xfd, - 0x45, 0x49, 0x8a, 0x35, 0xce, 0x8b, 0x8c, 0x65, 0x08, 0x89, 0x38, 0x56, 0x71, 0xbc, 0x1c, 0x7a, - 0x1f, 0xe1, 0xf9, 0x48, 0xc0, 0xf1, 0x21, 0x33, 0x24, 0x8b, 0x92, 0x50, 0x86, 0x5e, 0x42, 0x93, - 0x45, 0xc5, 0x2f, 0xc2, 0x6c, 0xbd, 0xab, 0x0f, 0x9e, 0x84, 0x12, 0x21, 0x1b, 0x5a, 0x85, 0x48, - 0xb1, 0x8d, 0xae, 0x3e, 0xb0, 0x42, 0x05, 0xbd, 0x00, 0x5e, 0x9c, 0x13, 0xd1, 0x3c, 0x4b, 0x29, - 0x41, 0x0e, 0x3c, 0x2e, 0xe4, 0x99, 0x73, 0x59, 0xe1, 0x11, 0x7b, 0x01, 0xb4, 0xbf, 0xc4, 0x53, - 0x32, 0x8f, 0x54, 0xdb, 0x1e, 0x58, 0xf2, 0x71, 0x13, 0xb6, 0xce, 0x89, 0x6c, 0x6e, 0xca, 0xbb, - 0xaf, 0xeb, 0x9c, 0x78, 0x1b, 0x03, 0x3a, 0xaa, 0x48, 0xb6, 0xf8, 0x0c, 0xe6, 0x2c, 0x9d, 0xb1, - 0x09, 0xe5, 0xd7, 0xbc, 0xc8, 0x0c, 0x5e, 0xe3, 0x87, 0xd3, 0xe2, 0xf3, 0x42, 0xfc, 0x29, 0x4a, - 0x93, 0x3f, 0xa4, 0x08, 0xe1, 0x50, 0x2e, 0x62, 0xe8, 0x1b, 0x3c, 0x23, 0x2b, 0x12, 0x97, 0x8c, - 0x4c, 0xa6, 0x22, 0x4c, 0x6d, 0xa3, 0xdb, 0xb8, 0x91, 0xf1, 0xa9, 0xe4, 0x90, 0x98, 0xa2, 0x31, - 0x74, 0xb8, 0x15, 0x27, 0xd2, 0xc6, 0xcd, 0xa4, 0x6d, 0xce, 0xa0, 0x28, 0x9d, 0xf7, 0xd0, 0x92, - 0xe7, 0xaa, 0x2d, 0x42, 0x32, 0x05, 0xcf, 0xe4, 0x37, 0x78, 0xe8, 0x24, 0x3f, 0x06, 0x34, 0x3a, - 0x29, 0xab, 0x3c, 0xb0, 0xa1, 0x15, 0x25, 0x49, 0x41, 0x28, 0x55, 0x5c, 0x12, 0x7a, 0xef, 0x8e, - 0xbb, 0x22, 0xf2, 0xa5, 0xfc, 0xf5, 0xa6, 0x05, 0xff, 0x0c, 0x78, 0xc4, 0xd7, 0x02, 0xc5, 0x60, - 0x55, 0xd7, 0x04, 0xf5, 0x2f, 0xcd, 0x7f, 0x61, 0x23, 0x9d, 0x41, 0x7d, 0xa2, 0x1c, 0x4b, 0x43, - 0x63, 0x68, 0x4a, 0x37, 0x7b, 0xd7, 0xe4, 0x15, 0xc4, 0x5e, 0xbd, 0x03, 0x9e, 0x86, 0x7e, 0x80, - 0x59, 0x99, 0x1d, 0xbd, 0xba, 0xf2, 0x9a, 0x8a, 0x98, 0x4e, 0xbf, 0x36, 0x4f, 0x75, 0xf8, 0xf0, - 0x76, 0xb3, 0x73, 0xf5, 0xed, 0xce, 0xd5, 0xef, 0x76, 0xae, 0xfe, 0x77, 0xef, 0x6a, 0xdb, 0xbd, - 0xab, 0xfd, 0xdf, 0xbb, 0xda, 0x77, 0x47, 0x70, 0xd0, 0xe4, 0x37, 0x9e, 0x65, 0xfe, 0xaa, 0xfa, - 0xbf, 0x7f, 0x36, 0xf9, 0xd7, 0x7e, 0x73, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xba, 0x54, 0xa3, 0xf0, - 0xfc, 0x03, 0x00, 0x00, + // 453 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xbf, 0x8e, 0xd3, 0x40, + 0x10, 0xc6, 0x6d, 0x9f, 0x48, 0x60, 0x7c, 0x77, 0xa0, 0xe5, 0x84, 0x8c, 0x0b, 0x2b, 0xe7, 0x82, + 0x8b, 0x28, 0xd6, 0x5c, 0xa0, 0xa0, 0x43, 0xa1, 0x3a, 0x89, 0x2a, 0x06, 0x1a, 0x24, 0x14, 0x7c, + 0xf6, 0x92, 0x8b, 0xb8, 0x78, 0x1d, 0xef, 0x3a, 0x8a, 0xdf, 0x82, 0x57, 0xe0, 0x6d, 0x52, 0xa6, + 0xa4, 0x44, 0xc9, 0x8b, 0xa0, 0xec, 0x9f, 0xd8, 0x11, 0x21, 0x56, 0x3a, 0xcf, 0xce, 0xb7, 0xbf, + 0xd9, 0x99, 0x6f, 0x12, 0xf0, 0x62, 0xca, 0x26, 0x94, 0x05, 0x51, 0x1c, 0xd3, 0x22, 0xe5, 0x2c, + 0x98, 0x5d, 0x07, 0xd3, 0x82, 0xe4, 0x25, 0xce, 0x72, 0xca, 0x29, 0x42, 0x32, 0x8f, 0x75, 0x1e, + 0xcf, 0xae, 0xdd, 0xe7, 0x23, 0x4a, 0x47, 0xf7, 0x24, 0x10, 0x8a, 0xdb, 0xe2, 0x7b, 0x10, 0xa5, + 0x4a, 0xee, 0x7f, 0x85, 0xa7, 0x7d, 0xa9, 0x1c, 0x6c, 0x20, 0x21, 0x99, 0x16, 0x84, 0x71, 0xf4, + 0x0c, 0x5a, 0x3c, 0xca, 0x47, 0x84, 0x3b, 0x66, 0xc7, 0xec, 0x3e, 0x0a, 0x55, 0x84, 0x30, 0xb4, + 0x73, 0x29, 0x71, 0xac, 0x8e, 0xd9, 0xb5, 0x7b, 0x17, 0x58, 0xb2, 0xb1, 0x66, 0xe3, 0x7e, 0x5a, + 0x86, 0x5a, 0xe4, 0xdf, 0xc0, 0xc5, 0x2e, 0x9e, 0x65, 0x34, 0x65, 0x04, 0xbd, 0x82, 0x87, 0xb9, + 0xfa, 0x16, 0x15, 0xfe, 0x07, 0xda, 0xaa, 0xfc, 0x1e, 0x9c, 0x7d, 0x8c, 0xef, 0xc8, 0x24, 0xd2, + 0x4f, 0xbc, 0x84, 0x53, 0xd5, 0xe3, 0x90, 0x97, 0x19, 0x51, 0x0f, 0xb5, 0xd5, 0xd9, 0xa7, 0x32, + 0x23, 0xfe, 0xc2, 0x82, 0x73, 0x7d, 0x49, 0x15, 0xfe, 0x00, 0xf6, 0x38, 0x1d, 0xf3, 0x21, 0x13, + 0xc7, 0xaa, 0xf6, 0x4b, 0xfc, 0xef, 0xd0, 0xf0, 0xee, 0x45, 0x7c, 0x13, 0xa5, 0xc9, 0x3d, 0xc9, + 0x43, 0xd8, 0x5c, 0x97, 0x39, 0xf4, 0x19, 0x9e, 0x90, 0x39, 0x89, 0x0b, 0x4e, 0x86, 0x77, 0x32, + 0xcd, 0x1c, 0xab, 0x73, 0x72, 0x24, 0xf1, 0xb1, 0x62, 0xa8, 0x98, 0xa1, 0x01, 0x9c, 0x0b, 0x47, + 0x2b, 0xe8, 0xc9, 0xd1, 0xd0, 0x33, 0x41, 0xd0, 0x48, 0xf7, 0x1d, 0xb4, 0xd5, 0x37, 0x72, 0x2a, + 0x0b, 0xe5, 0xc8, 0x74, 0x88, 0xdc, 0x9a, 0x29, 0x96, 0x48, 0x55, 0xe3, 0xc7, 0x80, 0xfa, 0xd5, + 0x64, 0xb5, 0x07, 0x0e, 0xb4, 0xa3, 0x24, 0xc9, 0x09, 0x63, 0x9a, 0xa5, 0x42, 0xff, 0xed, 0x76, + 0xaf, 0xa4, 0x5e, 0x8d, 0xbf, 0xd9, 0xb4, 0xde, 0x2f, 0x0b, 0x1e, 0x88, 0x65, 0x41, 0x31, 0x9c, + 0xd6, 0x97, 0x07, 0x5d, 0xed, 0xeb, 0x7f, 0xcf, 0xf6, 0xba, 0xdd, 0x66, 0xa1, 0x6a, 0xcb, 0x40, + 0x03, 0x68, 0x29, 0x37, 0x2f, 0x0f, 0x8d, 0x57, 0x82, 0xfd, 0x66, 0x07, 0x7c, 0x03, 0x7d, 0x03, + 0xbb, 0xd6, 0x3b, 0x7a, 0x71, 0xe0, 0x35, 0xb5, 0x61, 0xba, 0x57, 0x8d, 0x3a, 0x5d, 0xe1, 0xfd, + 0x9b, 0xc5, 0xca, 0x33, 0x97, 0x2b, 0xcf, 0xfc, 0xb3, 0xf2, 0xcc, 0x9f, 0x6b, 0xcf, 0x58, 0xae, + 0x3d, 0xe3, 0xf7, 0xda, 0x33, 0xbe, 0xb8, 0x92, 0xc1, 0x92, 0x1f, 0x78, 0x4c, 0x83, 0x79, 0xfd, + 0x6f, 0xe2, 0xb6, 0x25, 0x7e, 0x5a, 0xaf, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x95, 0x18, 0x10, + 0x13, 0x43, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -608,10 +611,15 @@ func (m *AccountQueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Request) > 0 { - i -= len(m.Request) - copy(dAtA[i:], m.Request) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Request))) + if m.Request != nil { + { + size, err := m.Request.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -645,10 +653,15 @@ func (m *AccountQueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Response) > 0 { - i -= len(m.Response) - copy(dAtA[i:], m.Response) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Response))) + if m.Response != nil { + { + size, err := m.Response.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -866,8 +879,8 @@ func (m *AccountQueryRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.Request) - if l > 0 { + if m.Request != nil { + l = m.Request.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -879,8 +892,8 @@ func (m *AccountQueryResponse) Size() (n int) { } var l int _ = l - l = len(m.Response) - if l > 0 { + if m.Response != nil { + l = m.Response.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -1038,7 +1051,7 @@ func (m *AccountQueryRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1048,24 +1061,26 @@ func (m *AccountQueryRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Request = append(m.Request[:0], dAtA[iNdEx:postIndex]...) if m.Request == nil { - m.Request = []byte{} + m.Request = &types.Any{} + } + if err := m.Request.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -1122,7 +1137,7 @@ func (m *AccountQueryResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1132,24 +1147,26 @@ func (m *AccountQueryResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Response = append(m.Response[:0], dAtA[iNdEx:postIndex]...) if m.Response == nil { - m.Response = []byte{} + m.Response = &types.Any{} + } + if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: diff --git a/x/accounts/v1/tx.pb.go b/x/accounts/v1/tx.pb.go index 44b955a2d593..ac2797d4dbc9 100644 --- a/x/accounts/v1/tx.pb.go +++ b/x/accounts/v1/tx.pb.go @@ -6,6 +6,7 @@ package v1 import ( context "context" fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -34,10 +35,8 @@ type MsgInit struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // account_type is the type of the account to be created. AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` - // message is the message to be sent to the account, it's up to the account - // implementation to decide what encoding format should be used to interpret - // this message. - Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // message is the message to be sent to the account. + Message *types.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` } func (m *MsgInit) Reset() { *m = MsgInit{} } @@ -87,7 +86,7 @@ func (m *MsgInit) GetAccountType() string { return "" } -func (m *MsgInit) GetMessage() []byte { +func (m *MsgInit) GetMessage() *types.Any { if m != nil { return m.Message } @@ -99,7 +98,7 @@ type MsgInitResponse struct { // account_address is the address of the newly created account. AccountAddress string `protobuf:"bytes,1,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"` // response is the response returned by the account implementation. - Response []byte `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` + Response *types.Any `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` } func (m *MsgInitResponse) Reset() { *m = MsgInitResponse{} } @@ -142,7 +141,7 @@ func (m *MsgInitResponse) GetAccountAddress() string { return "" } -func (m *MsgInitResponse) GetResponse() []byte { +func (m *MsgInitResponse) GetResponse() *types.Any { if m != nil { return m.Response } @@ -155,8 +154,8 @@ type MsgExecute struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // target is the address of the account to be executed. Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` - // message is the message to be sent to the account, it's up to the account - Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // message is the message to be sent to the account. + Message *types.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` } func (m *MsgExecute) Reset() { *m = MsgExecute{} } @@ -206,7 +205,7 @@ func (m *MsgExecute) GetTarget() string { return "" } -func (m *MsgExecute) GetMessage() []byte { +func (m *MsgExecute) GetMessage() *types.Any { if m != nil { return m.Message } @@ -216,7 +215,7 @@ func (m *MsgExecute) GetMessage() []byte { // MsgExecuteResponse defines the Execute response type for the Msg/Execute RPC method. type MsgExecuteResponse struct { // response is the response returned by the account implementation. - Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` + Response *types.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` } func (m *MsgExecuteResponse) Reset() { *m = MsgExecuteResponse{} } @@ -252,7 +251,7 @@ func (m *MsgExecuteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgExecuteResponse proto.InternalMessageInfo -func (m *MsgExecuteResponse) GetResponse() []byte { +func (m *MsgExecuteResponse) GetResponse() *types.Any { if m != nil { return m.Response } @@ -373,36 +372,38 @@ func init() { func init() { proto.RegisterFile("cosmos/accounts/v1/tx.proto", fileDescriptor_29c2b6d8a13d4189) } var fileDescriptor_29c2b6d8a13d4189 = []byte{ - // 460 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x6f, 0xd3, 0x30, - 0x14, 0xaf, 0x5b, 0x68, 0xd9, 0x6b, 0x61, 0xc8, 0x87, 0x11, 0x79, 0x52, 0xd4, 0x05, 0x04, 0x65, - 0x9a, 0x12, 0x36, 0x38, 0xed, 0xb6, 0x49, 0x08, 0x38, 0x54, 0x88, 0x08, 0x38, 0x70, 0x41, 0xa9, - 0x63, 0x45, 0xd5, 0x48, 0x1c, 0xf9, 0xb9, 0x53, 0x77, 0x40, 0x42, 0x7c, 0x00, 0xc4, 0x47, 0xd9, - 0xc7, 0xe0, 0xb8, 0x23, 0x47, 0xd4, 0x1e, 0xf6, 0x35, 0x50, 0x12, 0x3b, 0x2d, 0x63, 0xeb, 0x76, - 0xcb, 0x7b, 0xef, 0xf7, 0xcf, 0x7e, 0x31, 0x6c, 0x72, 0x89, 0xa9, 0xc4, 0x20, 0xe2, 0x5c, 0x4e, - 0x32, 0x8d, 0xc1, 0xf1, 0x6e, 0xa0, 0xa7, 0x7e, 0xae, 0xa4, 0x96, 0x94, 0x56, 0x43, 0xdf, 0x0e, - 0xfd, 0xe3, 0x5d, 0xf6, 0xc0, 0x10, 0x52, 0x4c, 0x0a, 0x6c, 0x8a, 0x49, 0x05, 0x66, 0x3b, 0x97, - 0x28, 0x99, 0xef, 0xcf, 0xd1, 0x08, 0xb5, 0x8a, 0xb8, 0x1e, 0xcb, 0xac, 0x42, 0x7b, 0x47, 0xd0, - 0x19, 0x62, 0xf2, 0x26, 0x1b, 0x6b, 0xba, 0x01, 0x6d, 0x14, 0x59, 0x2c, 0x94, 0x43, 0xfa, 0x64, - 0xb0, 0x16, 0x9a, 0x8a, 0x6e, 0x41, 0xcf, 0xf2, 0xf5, 0x49, 0x2e, 0x9c, 0x66, 0x39, 0xed, 0x9a, - 0xde, 0xfb, 0x93, 0x5c, 0x50, 0x07, 0x3a, 0xa9, 0x40, 0x8c, 0x12, 0xe1, 0xb4, 0xfa, 0x64, 0xd0, - 0x0b, 0x6d, 0xb9, 0xdf, 0xfd, 0x7e, 0x7e, 0xba, 0x6d, 0x94, 0xbc, 0x8f, 0xb0, 0x6e, 0xcc, 0x42, - 0x81, 0xb9, 0xcc, 0x50, 0xd0, 0x27, 0xb0, 0x5e, 0x87, 0x8b, 0x63, 0x25, 0x10, 0x8d, 0xfb, 0x3d, - 0xd3, 0x3e, 0xa8, 0xba, 0x94, 0xc1, 0x1d, 0x65, 0x48, 0x65, 0x82, 0x5e, 0x58, 0xd7, 0x1e, 0x07, - 0x18, 0x62, 0xf2, 0x72, 0x2a, 0xf8, 0x44, 0x8b, 0x2b, 0xcf, 0xb1, 0x01, 0x6d, 0x1d, 0xa9, 0x44, - 0x68, 0x73, 0x02, 0x53, 0xdd, 0x34, 0xfc, 0x33, 0xa0, 0x0b, 0x93, 0x3a, 0xff, 0x72, 0x2c, 0x72, - 0x21, 0xd6, 0x57, 0xb8, 0xbf, 0x60, 0x1c, 0x4e, 0xb2, 0xf8, 0x4b, 0x79, 0x53, 0xa3, 0xf2, 0xcb, - 0xa6, 0xb3, 0x25, 0x3d, 0x00, 0x90, 0xb9, 0x50, 0x51, 0xb1, 0x1c, 0x74, 0x9a, 0xfd, 0xd6, 0xa0, - 0xbb, 0xb7, 0xe5, 0xff, 0xbf, 0x79, 0xff, 0x03, 0x0a, 0xf5, 0xd6, 0x22, 0xc3, 0x25, 0xd2, 0x7e, - 0xaf, 0xc8, 0x6b, 0x05, 0x3d, 0x0e, 0xce, 0x45, 0xfb, 0x3a, 0xf6, 0x2b, 0x58, 0xb3, 0x31, 0x8b, - 0x0b, 0x2f, 0xbc, 0x9e, 0x5e, 0xef, 0x65, 0x18, 0xe1, 0x82, 0xbb, 0xf7, 0xa3, 0x09, 0xad, 0x21, - 0x26, 0xf4, 0x35, 0xdc, 0x2a, 0x7f, 0xa2, 0xcd, 0xcb, 0x54, 0xcc, 0xd2, 0xd9, 0xc3, 0x15, 0xc3, - 0x3a, 0xda, 0x3b, 0xe8, 0xd8, 0x4d, 0xba, 0x57, 0xe0, 0xcd, 0x9c, 0x3d, 0x5e, 0x3d, 0xaf, 0x25, - 0x39, 0xdc, 0xfd, 0x77, 0x0b, 0x8f, 0x56, 0x13, 0x2b, 0x14, 0xdb, 0xb9, 0x09, 0xca, 0x9a, 0xb0, - 0xdb, 0xdf, 0xce, 0x4f, 0xb7, 0xc9, 0xe1, 0x8b, 0x5f, 0x33, 0x97, 0x9c, 0xcd, 0x5c, 0xf2, 0x67, - 0xe6, 0x92, 0x9f, 0x73, 0xb7, 0x71, 0x36, 0x77, 0x1b, 0xbf, 0xe7, 0x6e, 0xe3, 0x13, 0xab, 0xd4, - 0x30, 0x3e, 0xf2, 0xc7, 0x32, 0x98, 0x2e, 0x3f, 0xd0, 0x51, 0xbb, 0x7c, 0x8d, 0xcf, 0xff, 0x06, - 0x00, 0x00, 0xff, 0xff, 0x02, 0x12, 0x2a, 0x01, 0x07, 0x04, 0x00, 0x00, + // 491 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xcd, 0x24, 0x90, 0xd0, 0x9b, 0x42, 0xd1, 0x08, 0x15, 0xe3, 0x4a, 0x56, 0x1a, 0x10, 0x84, + 0xaa, 0x1a, 0xd3, 0xc0, 0xaa, 0xbb, 0x54, 0xe2, 0xb5, 0x88, 0x10, 0x16, 0x6c, 0xd8, 0x20, 0xc7, + 0x1e, 0x46, 0x11, 0x89, 0xc7, 0xf2, 0x9d, 0x54, 0xf1, 0x02, 0x09, 0xf8, 0x00, 0xc4, 0xa7, 0xf4, + 0x33, 0x58, 0x76, 0xc9, 0x12, 0x25, 0x8b, 0xfe, 0x06, 0xb2, 0x3d, 0xe3, 0x04, 0x68, 0x42, 0xa5, + 0xee, 0x3c, 0x73, 0xce, 0x3d, 0x0f, 0xcd, 0x35, 0xec, 0x04, 0x12, 0xc7, 0x12, 0x5d, 0x3f, 0x08, + 0xe4, 0x24, 0x52, 0xe8, 0x1e, 0x1f, 0xb8, 0x6a, 0xca, 0xe2, 0x44, 0x2a, 0x49, 0x69, 0x01, 0x32, + 0x03, 0xb2, 0xe3, 0x03, 0xfb, 0x8e, 0x90, 0x52, 0x8c, 0xb8, 0x9b, 0x33, 0x06, 0x93, 0x0f, 0xae, + 0x1f, 0xa5, 0x05, 0xdd, 0xbe, 0xad, 0xb5, 0xc6, 0x28, 0x32, 0x99, 0x31, 0x0a, 0x0d, 0xec, 0x9f, + 0x63, 0xa2, 0xbf, 0xdf, 0xfb, 0x03, 0x54, 0x89, 0x1f, 0xa8, 0xa1, 0x8c, 0x0a, 0x76, 0xfb, 0x0b, + 0x81, 0x46, 0x1f, 0xc5, 0xcb, 0x68, 0xa8, 0xe8, 0x36, 0xd4, 0x91, 0x47, 0x21, 0x4f, 0x2c, 0xd2, + 0x22, 0x9d, 0x0d, 0x4f, 0x9f, 0xe8, 0x2e, 0x6c, 0x1a, 0x01, 0x95, 0xc6, 0xdc, 0xaa, 0xe6, 0x68, + 0x53, 0xdf, 0xbd, 0x49, 0x63, 0x4e, 0x19, 0x34, 0xc6, 0x1c, 0xd1, 0x17, 0xdc, 0xaa, 0xb5, 0x48, + 0xa7, 0xd9, 0xbd, 0xc5, 0x8a, 0xe8, 0xcc, 0x44, 0x67, 0xbd, 0x28, 0xf5, 0x0c, 0xe9, 0xb0, 0xf9, + 0xf5, 0xec, 0x64, 0x4f, 0xeb, 0xb7, 0x47, 0xb0, 0xa5, 0x23, 0x78, 0x1c, 0x63, 0x19, 0x21, 0xa7, + 0x0f, 0x60, 0xab, 0xcc, 0x1c, 0x86, 0x09, 0x47, 0xd4, 0x99, 0x6e, 0xe8, 0xeb, 0x5e, 0x71, 0x4b, + 0x1f, 0xc1, 0xb5, 0x44, 0x0f, 0xe5, 0xb9, 0x56, 0x39, 0x97, 0xac, 0x76, 0x0a, 0xd0, 0x47, 0xf1, + 0x74, 0xca, 0x83, 0x89, 0xe2, 0x2b, 0x3b, 0x6f, 0x43, 0x5d, 0xf9, 0x89, 0xe0, 0x4a, 0xb7, 0xd5, + 0xa7, 0xcb, 0x15, 0x7d, 0x06, 0x74, 0x61, 0x5d, 0x76, 0x5d, 0xae, 0x40, 0x2e, 0x54, 0xe1, 0x13, + 0xdc, 0x5c, 0xe8, 0x1c, 0x4d, 0xa2, 0x70, 0xc4, 0xa9, 0x05, 0x8d, 0x41, 0xfe, 0x65, 0x9a, 0x98, + 0x23, 0xed, 0x01, 0xc8, 0x98, 0x27, 0x7e, 0xf6, 0xea, 0x68, 0x55, 0x5b, 0xb5, 0x4e, 0xb3, 0xbb, + 0xcb, 0xfe, 0xdd, 0x36, 0xf6, 0x16, 0x79, 0xf2, 0xca, 0x30, 0xbd, 0xa5, 0xa1, 0xc3, 0xcd, 0xac, + 0x85, 0x11, 0x6c, 0x07, 0x60, 0xfd, 0x6d, 0x5f, 0x96, 0x79, 0x0e, 0x1b, 0x26, 0x66, 0xf6, 0x64, + 0x99, 0xd7, 0xc3, 0xff, 0x7b, 0xe9, 0x09, 0x6f, 0x31, 0xdb, 0xfd, 0x56, 0x85, 0x5a, 0x1f, 0x05, + 0x7d, 0x01, 0x57, 0xf2, 0xe5, 0xdc, 0x39, 0x4f, 0x45, 0xaf, 0x8d, 0x7d, 0x77, 0x0d, 0x58, 0x46, + 0x7b, 0x0d, 0x0d, 0xf3, 0xea, 0xce, 0x0a, 0xbe, 0xc6, 0xed, 0xfb, 0xeb, 0xf1, 0x52, 0x32, 0x80, + 0xeb, 0x7f, 0xbe, 0xc2, 0xbd, 0xf5, 0x83, 0x05, 0xcb, 0xde, 0xbf, 0x08, 0xcb, 0x98, 0xd8, 0x57, + 0x3f, 0x9f, 0x9d, 0xec, 0x91, 0xa3, 0x27, 0x3f, 0x66, 0x0e, 0x39, 0x9d, 0x39, 0xe4, 0xd7, 0xcc, + 0x21, 0xdf, 0xe7, 0x4e, 0xe5, 0x74, 0xee, 0x54, 0x7e, 0xce, 0x9d, 0xca, 0x3b, 0xbb, 0x50, 0xc3, + 0xf0, 0x23, 0x1b, 0x4a, 0x77, 0xba, 0xfc, 0xe7, 0x0f, 0xea, 0xf9, 0x0a, 0x3d, 0xfe, 0x1d, 0x00, + 0x00, 0xff, 0xff, 0x38, 0x4c, 0xe4, 0x12, 0x7b, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -585,10 +586,15 @@ func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Message) > 0 { - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintTx(dAtA, i, uint64(len(m.Message))) + if m.Message != nil { + { + size, err := m.Message.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x1a } @@ -629,10 +635,15 @@ func (m *MsgInitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Response) > 0 { - i -= len(m.Response) - copy(dAtA[i:], m.Response) - i = encodeVarintTx(dAtA, i, uint64(len(m.Response))) + if m.Response != nil { + { + size, err := m.Response.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -666,10 +677,15 @@ func (m *MsgExecute) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Message) > 0 { - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintTx(dAtA, i, uint64(len(m.Message))) + if m.Message != nil { + { + size, err := m.Message.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x1a } @@ -710,10 +726,15 @@ func (m *MsgExecuteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Response) > 0 { - i -= len(m.Response) - copy(dAtA[i:], m.Response) - i = encodeVarintTx(dAtA, i, uint64(len(m.Response))) + if m.Response != nil { + { + size, err := m.Response.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -826,8 +847,8 @@ func (m *MsgInit) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Message) - if l > 0 { + if m.Message != nil { + l = m.Message.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -843,8 +864,8 @@ func (m *MsgInitResponse) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Response) - if l > 0 { + if m.Response != nil { + l = m.Response.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -864,8 +885,8 @@ func (m *MsgExecute) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Message) - if l > 0 { + if m.Message != nil { + l = m.Message.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -877,8 +898,8 @@ func (m *MsgExecuteResponse) Size() (n int) { } var l int _ = l - l = len(m.Response) - if l > 0 { + if m.Response != nil { + l = m.Response.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -1021,7 +1042,7 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1031,24 +1052,26 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) if m.Message == nil { - m.Message = []byte{} + m.Message = &types.Any{} + } + if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -1137,7 +1160,7 @@ func (m *MsgInitResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1147,24 +1170,26 @@ func (m *MsgInitResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Response = append(m.Response[:0], dAtA[iNdEx:postIndex]...) if m.Response == nil { - m.Response = []byte{} + m.Response = &types.Any{} + } + if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -1285,7 +1310,7 @@ func (m *MsgExecute) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1295,24 +1320,26 @@ func (m *MsgExecute) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) if m.Message == nil { - m.Message = []byte{} + m.Message = &types.Any{} + } + if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -1369,7 +1396,7 @@ func (m *MsgExecuteResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1379,24 +1406,26 @@ func (m *MsgExecuteResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Response = append(m.Response[:0], dAtA[iNdEx:postIndex]...) if m.Response == nil { - m.Response = []byte{} + m.Response = &types.Any{} + } + if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: diff --git a/x/auth/CHANGELOG.md b/x/auth/CHANGELOG.md index fcabad64e900..85ad31d77969 100644 --- a/x/auth/CHANGELOG.md +++ b/x/auth/CHANGELOG.md @@ -32,5 +32,3 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes ### Bug Fixes - -* (client/cli) [#18564](https://github.com/cosmos/cosmos-sdk/pull/18564) Fix total fees calculation when batch signing diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index 987c7dedb83f..615c478dc60f 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -399,7 +399,7 @@ func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simul // BaseApp.Commit() will set the check state based on the latest header. // // NOTE: Since CheckTx and DeliverTx state are managed separately, subsequent and -// sequential txs orginating from the same account cannot be handled correctly in +// sequential txs originating from the same account cannot be handled correctly in // a reliable way unless sequence numbers are managed and tracked manually by a // client. It is recommended to instead use multiple messages in a tx. type IncrementSequenceDecorator struct { diff --git a/x/auth/ante/sigverify_test.go b/x/auth/ante/sigverify_test.go index 210ca3f70a1c..ab6e4069914d 100644 --- a/x/auth/ante/sigverify_test.go +++ b/x/auth/ante/sigverify_test.go @@ -4,7 +4,6 @@ import ( "fmt" "testing" - secp256k1dcrd "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -392,16 +391,10 @@ func TestAnteHandlerChecks(t *testing.T) { // keys and addresses priv1, _, addr1 := testdata.KeyTestPubAddr() - - secp256k1NotOnCurve, _ := secp256k1dcrd.GeneratePrivateKey() - secp256k1NotOnCurve.Key.SetInt(0) // Setting the key point to 0, results in an invalid point on the curve. - priv12 := &secp256k1.PrivKey{Key: secp256k1NotOnCurve.Serialize()} - addr12 := sdk.AccAddress(priv12.PubKey().Address()) - priv2, _, addr2 := testdata.KeyTestPubAddrSecp256R1(t) priv3, _, addr3 := testdata.KeyTestPubAddrED25519() - addrs := []sdk.AccAddress{addr1, addr12, addr2, addr3} + addrs := []sdk.AccAddress{addr1, addr2, addr3} msgs := make([]sdk.Msg, len(addrs)) accs := make([]sdk.AccountI, len(addrs)) @@ -428,15 +421,14 @@ func TestAnteHandlerChecks(t *testing.T) { accNums []uint64 accSeqs []uint64 shouldErr bool - suported bool + supported bool } // Secp256r1 keys that are not on curve will fail before even doing any operation i.e when trying to get the pubkey testCases := []testCase{ {"secp256k1_onCurve", []cryptotypes.PrivKey{priv1}, msgs[0], []uint64{accs[0].GetAccountNumber()}, []uint64{0}, false, true}, - {"secp256k1_NotOnCurve", []cryptotypes.PrivKey{priv12}, msgs[1], []uint64{accs[1].GetAccountNumber()}, []uint64{1}, true, true}, - {"secp256r1_onCurve", []cryptotypes.PrivKey{priv2}, msgs[2], []uint64{accs[2].GetAccountNumber()}, []uint64{0}, false, true}, - {"ed255619", []cryptotypes.PrivKey{priv3}, msgs[3], []uint64{accs[2].GetAccountNumber()}, []uint64{3}, true, false}, + {"secp256r1_onCurve", []cryptotypes.PrivKey{priv2}, msgs[1], []uint64{accs[1].GetAccountNumber()}, []uint64{0}, false, true}, + {"ed255619", []cryptotypes.PrivKey{priv3}, msgs[2], []uint64{accs[2].GetAccountNumber()}, []uint64{2}, true, false}, } for i, tc := range testCases { @@ -458,7 +450,7 @@ func TestAnteHandlerChecks(t *testing.T) { _, err = anteHandler(byteCtx, tx, true) if tc.shouldErr { require.NotNil(t, err, "TestCase %d: %s did not error as expected", i, tc.name) - if tc.suported { + if tc.supported { require.ErrorContains(t, err, "not on curve") } else { require.ErrorContains(t, err, "unsupported key type") diff --git a/x/auth/go.mod b/x/auth/go.mod index 4197da159912..e3d0025edc8d 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -39,7 +39,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -116,7 +118,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -141,15 +143,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/auth/go.sum b/x/auth/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/auth/tx/README.md b/x/auth/tx/README.md index 1706690d324d..5b1b1c0961d9 100644 --- a/x/auth/tx/README.md +++ b/x/auth/tx/README.md @@ -111,7 +111,7 @@ simd query blocks --query 'message.sender=cosmos...' --page 1 --limit 30 #### Transactions -The `x/auth/tx` module provides a convinient CLI command for decoding and encoding transactions. +The `x/auth/tx` module provides a convenient CLI command for decoding and encoding transactions. #### `encode` diff --git a/x/auth/vesting/README.md b/x/auth/vesting/README.md index 5c04614f7c25..8cc6ceb6c4ab 100644 --- a/x/auth/vesting/README.md +++ b/x/auth/vesting/README.md @@ -35,8 +35,8 @@ This specification defines the vesting account implementation that is used by th For all vesting accounts, the owner of the vesting account is able to delegate and undelegate from validators, however they cannot transfer coins to another account until those coins are vested. This specification allows for four different kinds of vesting: * Delayed vesting, where all coins are vested once `ET` is reached. -* Continous vesting, where coins begin to vest at `ST` and vest linearly with respect to time until `ET` is reached -* Periodic vesting, where coins begin to vest at `ST` and vest periodically according to number of periods and the vesting amount per period. The number of periods, length per period, and amount per period are configurable. A periodic vesting account is distinguished from a continuous vesting account in that coins can be released in staggered tranches. For example, a periodic vesting account could be used for vesting arrangements where coins are relased quarterly, yearly, or over any other function of tokens over time. +* Continuous vesting, where coins begin to vest at `ST` and vest linearly with respect to time until `ET` is reached +* Periodic vesting, where coins begin to vest at `ST` and vest periodically according to number of periods and the vesting amount per period. The number of periods, length per period, and amount per period are configurable. A periodic vesting account is distinguished from a continuous vesting account in that coins can be released in staggered tranches. For example, a periodic vesting account could be used for vesting arrangements where coins are released quarterly, yearly, or over any other function of tokens over time. * Permanent locked vesting, where coins are locked forever. Coins in this account can still be used for delegating and for governance votes even while locked. ## Note @@ -543,7 +543,7 @@ V' = 0 V' = 25 ``` -3. During vesting period 2, 5 coins are transfered and 5 coins are delegated +3. During vesting period 2, 5 coins are transferred and 5 coins are delegated ```text DV = 5 diff --git a/x/authz/README.md b/x/authz/README.md index 2ab2dcba7c74..b75fc10ba0b6 100644 --- a/x/authz/README.md +++ b/x/authz/README.md @@ -82,7 +82,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/bank/types/send_authoriz #### StakeAuthorization -`StakeAuthorization` implements the `Authorization` interface for messages in the [staking module](https://docs.cosmos.network/v0.44/modules/staking/). It takes an `AuthorizationType` to specify whether you want to authorise delegating, undelegating or redelegating (i.e. these have to be authorised seperately). It also takes a required `MaxTokens` that keeps track of a limit to the amount of tokens that can be delegated/undelegated/redelegated. If left empty, the amount is unlimited. Additionally, this Msg takes an `AllowList` or a `DenyList`, which allows you to select which validators you allow or deny grantees to stake with. +`StakeAuthorization` implements the `Authorization` interface for messages in the [staking module](https://docs.cosmos.network/v0.44/modules/staking/). It takes an `AuthorizationType` to specify whether you want to authorise delegating, undelegating or redelegating (i.e. these have to be authorised separately). It also takes a required `MaxTokens` that keeps track of a limit to the amount of tokens that can be delegated/undelegated/redelegated. If left empty, the amount is unlimited. Additionally, this Msg takes an `AllowList` or a `DenyList`, which allows you to select which validators you allow or deny grantees to stake with. ```protobuf reference https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/staking/v1beta1/authz.proto#L11-L35 @@ -96,7 +96,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/staking/types/authz.go#L In order to prevent DoS attacks, granting `StakeAuthorization`s with `x/authz` incurs gas. `StakeAuthorization` allows you to authorize another account to delegate, undelegate, or redelegate to validators. The authorizer can define a list of validators they allow or deny delegations to. The Cosmos SDK iterates over these lists and charge 10 gas for each validator in both of the lists. -Since the state maintaining a list for granter, grantee pair with same expiration, we are iterating over the list to remove the grant (incase of any revoke of paritcular `msgType`) from the list and we are charging 20 gas per iteration. +Since the state maintaining a list for granter, grantee pair with same expiration, we are iterating over the list to remove the grant (in case of any revoke of paritcular `msgType`) from the list and we are charging 20 gas per iteration. ## State diff --git a/x/authz/event.pb.go b/x/authz/event.pb.go index 1fdd7c4edad2..0e8936183180 100644 --- a/x/authz/event.pb.go +++ b/x/authz/event.pb.go @@ -25,7 +25,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // EventGrant is emitted on Msg/Grant type EventGrant struct { - // Msg type URL for which an autorization is granted + // Msg type URL for which an authorization is granted MsgTypeUrl string `protobuf:"bytes,2,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` // Granter account address Granter string `protobuf:"bytes,3,opt,name=granter,proto3" json:"granter,omitempty"` @@ -89,7 +89,7 @@ func (m *EventGrant) GetGrantee() string { // EventRevoke is emitted on Msg/Revoke type EventRevoke struct { - // Msg type URL for which an autorization is revoked + // Msg type URL for which an authorization is revoked MsgTypeUrl string `protobuf:"bytes,2,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` // Granter account address Granter string `protobuf:"bytes,3,opt,name=granter,proto3" json:"granter,omitempty"` diff --git a/x/authz/go.mod b/x/authz/go.mod index 1f47f89e7b70..f7d8b2156613 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -36,7 +36,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -117,7 +119,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -143,15 +145,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/authz/go.sum b/x/authz/go.sum index ff01c1e55ea9..c15c4a1d170f 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -637,8 +639,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -799,6 +801,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/authz/simulation/operations.go b/x/authz/simulation/operations.go index 88f068d9ea0b..c73c562b5f37 100644 --- a/x/authz/simulation/operations.go +++ b/x/authz/simulation/operations.go @@ -285,7 +285,16 @@ func SimulateMsgExec( return simtypes.NoOpMsg(authz.ModuleName, TypeMsgExec, err.Error()), nil, nil } - msg := []sdk.Msg{banktype.NewMsgSend(granterAddr, granteeAddr, coins)} + graStr, err := ak.AddressCodec().BytesToString(granterAddr) + if err != nil { + return simtypes.NoOpMsg(authz.ModuleName, TypeMsgExec, err.Error()), nil, err + } + greStr, err := ak.AddressCodec().BytesToString(granteeAddr) + if err != nil { + return simtypes.NoOpMsg(authz.ModuleName, TypeMsgExec, err.Error()), nil, err + } + + msg := []sdk.Msg{banktype.NewMsgSend(graStr, greStr, coins)} _, err = sendAuth.Accept(ctx, msg[0]) if err != nil { diff --git a/x/bank/README.md b/x/bank/README.md index 217060fb4401..3bee1e5022a4 100644 --- a/x/bank/README.md +++ b/x/bank/README.md @@ -1012,7 +1012,7 @@ Example Output: ### SendEnabled -The `SendEnabled` enpoints allows users to query the SendEnabled entries of the `bank` module. +The `SendEnabled` endpoints allows users to query the SendEnabled entries of the `bank` module. Any denominations NOT returned, use the `Params.DefaultSendEnabled` value. diff --git a/x/bank/client/cli/tx_test.go b/x/bank/client/cli/tx_test.go index 9cd2813c2dd7..879b5e6a99a3 100644 --- a/x/bank/client/cli/tx_test.go +++ b/x/bank/client/cli/tx_test.go @@ -53,6 +53,12 @@ func (s *CLITestSuite) SetupSuite() { func (s *CLITestSuite) TestMultiSendTxCmd() { accounts := testutil.CreateKeyringAccounts(s.T(), s.kr, 3) + accountStr := make([]string, len(accounts)) + for i, acc := range accounts { + addrStr, err := s.baseCtx.AddressCodec.BytesToString(acc.Address) + s.Require().NoError(err) + accountStr[i] = addrStr + } cmd := cli.NewMultiSendTxCmd() cmd.SetOutput(io.Discard) @@ -79,10 +85,10 @@ func (s *CLITestSuite) TestMultiSendTxCmd() { func() client.Context { return s.baseCtx }, - accounts[0].Address.String(), + accountStr[0], []string{ - accounts[1].Address.String(), - accounts[2].Address.String(), + accountStr[1], + accountStr[2], }, sdk.NewCoins( sdk.NewCoin("stake", sdkmath.NewInt(10)), @@ -98,8 +104,8 @@ func (s *CLITestSuite) TestMultiSendTxCmd() { }, "foo", []string{ - accounts[1].Address.String(), - accounts[2].Address.String(), + accountStr[1], + accountStr[2], }, sdk.NewCoins( sdk.NewCoin("stake", sdkmath.NewInt(10)), @@ -113,9 +119,9 @@ func (s *CLITestSuite) TestMultiSendTxCmd() { func() client.Context { return s.baseCtx }, - accounts[0].Address.String(), + accountStr[0], []string{ - accounts[1].Address.String(), + accountStr[1], "bar", }, sdk.NewCoins( @@ -130,10 +136,10 @@ func (s *CLITestSuite) TestMultiSendTxCmd() { func() client.Context { return s.baseCtx }, - accounts[0].Address.String(), + accountStr[0], []string{ - accounts[1].Address.String(), - accounts[2].Address.String(), + accountStr[1], + accountStr[2], }, nil, extraArgs, diff --git a/x/bank/go.mod b/x/bank/go.mod index 499f03c461de..1ae06c8142a8 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -33,7 +33,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -111,7 +113,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -137,15 +139,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/bank/go.sum b/x/bank/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index 556cecdbeed4..9c2de78fd997 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -234,7 +234,10 @@ func (suite *KeeperTestSuite) TestSpendableBalanceByDenom() { _, err := queryClient.SpendableBalanceByDenom(ctx, &types.QuerySpendableBalanceByDenomRequest{}) suite.Require().Error(err) - req := types.NewQuerySpendableBalanceByDenomRequest(addr, fooDenom) + addrStr, err := suite.authKeeper.AddressCodec().BytesToString(addr) + suite.Require().NoError(err) + + req := types.NewQuerySpendableBalanceByDenomRequest(addrStr, fooDenom) acc := authtypes.NewBaseAccountWithAddress(addr) suite.mockSpendableCoins(ctx, acc) diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index e3bafc0a1ad1..129c8ce4a839 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -152,12 +152,16 @@ func (k BaseKeeper) DelegateCoins(ctx context.Context, delegatorAddr, moduleAccA return errorsmod.Wrap(err, "failed to track delegation") } // emit coin spent event + delAddrStr, err := k.ak.AddressCodec().BytesToString(delegatorAddr) + if err != nil { + return err + } sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx.EventManager().EmitEvent( - types.NewCoinSpentEvent(delegatorAddr, amt), + types.NewCoinSpentEvent(delAddrStr, amt), ) - err := k.addCoins(ctx, moduleAccAddr, amt) + err = k.addCoins(ctx, moduleAccAddr, amt) if err != nil { return err } @@ -254,14 +258,14 @@ func (k BaseKeeper) SetDenomMetaData(ctx context.Context, denomMetaData types.Me } // SendCoinsFromModuleToAccount transfers coins from a ModuleAccount to an AccAddress. -// It will panic if the module account does not exist. An error is returned if +// An error is returned if the module account does not exist or if // the recipient address is black-listed or if sending the tokens fails. func (k BaseKeeper) SendCoinsFromModuleToAccount( ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, ) error { senderAddr := k.ak.GetModuleAddress(senderModule) if senderAddr == nil { - panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule) } if k.BlockedAddr(recipientAddr) { @@ -272,74 +276,74 @@ func (k BaseKeeper) SendCoinsFromModuleToAccount( } // SendCoinsFromModuleToModule transfers coins from a ModuleAccount to another. -// It will panic if either module account does not exist. +// An error is returned if either module accounts does not exist. func (k BaseKeeper) SendCoinsFromModuleToModule( ctx context.Context, senderModule, recipientModule string, amt sdk.Coins, ) error { senderAddr := k.ak.GetModuleAddress(senderModule) if senderAddr == nil { - panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule) } recipientAcc := k.ak.GetModuleAccount(ctx, recipientModule) if recipientAcc == nil { - panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule) } return k.SendCoins(ctx, senderAddr, recipientAcc.GetAddress(), amt) } // SendCoinsFromAccountToModule transfers coins from an AccAddress to a ModuleAccount. -// It will panic if the module account does not exist. +// An error is returned if the module account does not exist. func (k BaseKeeper) SendCoinsFromAccountToModule( ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error { recipientAcc := k.ak.GetModuleAccount(ctx, recipientModule) if recipientAcc == nil { - panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule) } return k.SendCoins(ctx, senderAddr, recipientAcc.GetAddress(), amt) } // DelegateCoinsFromAccountToModule delegates coins and transfers them from a -// delegator account to a module account. It will panic if the module account +// delegator account to a module account. An error is returned if the module account // does not exist or is unauthorized. func (k BaseKeeper) DelegateCoinsFromAccountToModule( ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error { recipientAcc := k.ak.GetModuleAccount(ctx, recipientModule) if recipientAcc == nil { - panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule) } if !recipientAcc.HasPermission(authtypes.Staking) { - panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to receive delegated coins", recipientModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to receive delegated coins", recipientModule) } return k.DelegateCoins(ctx, senderAddr, recipientAcc.GetAddress(), amt) } // UndelegateCoinsFromModuleToAccount undelegates the unbonding coins and transfers -// them from a module account to the delegator account. It will panic if the +// them from a module account to the delegator account. An error is returned if the // module account does not exist or is unauthorized. func (k BaseKeeper) UndelegateCoinsFromModuleToAccount( ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, ) error { acc := k.ak.GetModuleAccount(ctx, senderModule) if acc == nil { - panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", senderModule) } if !acc.HasPermission(authtypes.Staking) { - panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to undelegate coins", senderModule)) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to undelegate coins", senderModule) } return k.UndelegateCoins(ctx, acc.GetAddress(), recipientAddr, amt) } // MintCoins creates new coins from thin air and adds it to the module account. -// It will panic if the module account does not exist or is unauthorized. +// An error is returned if the module account does not exist or is unauthorized. func (k BaseKeeper) MintCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error { sdkCtx := sdk.UnwrapSDKContext(ctx) @@ -350,11 +354,11 @@ func (k BaseKeeper) MintCoins(ctx context.Context, moduleName string, amounts sd } acc := k.ak.GetModuleAccount(ctx, moduleName) if acc == nil { - panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName) } if !acc.HasPermission(authtypes.Minter) { - panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to mint tokens", moduleName)) + return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s does not have permissions to mint tokens", moduleName) } err = k.addCoins(ctx, acc.GetAddress(), amounts) @@ -370,16 +374,20 @@ func (k BaseKeeper) MintCoins(ctx context.Context, moduleName string, amounts sd k.logger.Debug("minted coins from module account", "amount", amounts.String(), "from", moduleName) + addrStr, err := k.ak.AddressCodec().BytesToString(acc.GetAddress()) + if err != nil { + return err + } // emit mint event sdkCtx.EventManager().EmitEvent( - types.NewCoinMintEvent(acc.GetAddress(), amounts), + types.NewCoinMintEvent(addrStr, amounts), ) return nil } // BurnCoins burns coins deletes coins from the balance of the module account. -// It will panic if the module account does not exist or is unauthorized. +// An error is returned if the module account does not exist or is unauthorized. func (k BaseKeeper) BurnCoins(ctx context.Context, address []byte, amounts sdk.Coins) error { acc := k.ak.GetAccount(ctx, address) if acc == nil { @@ -405,10 +413,14 @@ func (k BaseKeeper) BurnCoins(ctx context.Context, address []byte, amounts sdk.C k.logger.Debug("burned tokens from account", "amount", amounts.String(), "from", address) + addrStr, err := k.ak.AddressCodec().BytesToString(acc.GetAddress()) + if err != nil { + return err + } // emit burn event sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx.EventManager().EmitEvent( - types.NewCoinBurnEvent(acc.GetAddress(), amounts), + types.NewCoinBurnEvent(addrStr, amounts), ) return nil diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index 5a25feb7d26c..4aa3b503f08e 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -396,20 +396,17 @@ func (suite *KeeperTestSuite) TestSupply_DelegateUndelegateCoins() { require.NoError(keeper.SendCoinsFromModuleToAccount(ctx, banktypes.MintModuleName, holderAcc.GetAddress(), initCoins)) authKeeper.EXPECT().GetModuleAddress("").Return(nil) - require.Panics(func() { - _ = keeper.SendCoinsFromModuleToAccount(ctx, "", holderAcc.GetAddress(), initCoins) - }) + err := keeper.SendCoinsFromModuleToAccount(ctx, "", holderAcc.GetAddress(), initCoins) + require.Error(err) authKeeper.EXPECT().GetModuleAddress(burnerAcc.Name).Return(burnerAcc.GetAddress()) authKeeper.EXPECT().GetModuleAccount(ctx, "").Return(nil) - require.Panics(func() { - _ = keeper.SendCoinsFromModuleToModule(ctx, authtypes.Burner, "", initCoins) - }) + err = keeper.SendCoinsFromModuleToModule(ctx, authtypes.Burner, "", initCoins) + require.Error(err) authKeeper.EXPECT().GetModuleAddress("").Return(nil) - require.Panics(func() { - _ = keeper.SendCoinsFromModuleToAccount(ctx, "", baseAcc.GetAddress(), initCoins) - }) + err = keeper.SendCoinsFromModuleToAccount(ctx, "", baseAcc.GetAddress(), initCoins) + require.Error(err) authKeeper.EXPECT().GetModuleAddress(holderAcc.Name).Return(holderAcc.GetAddress()) authKeeper.EXPECT().GetAccount(suite.ctx, holderAcc.GetAddress()).Return(holderAcc) @@ -456,20 +453,17 @@ func (suite *KeeperTestSuite) TestSupply_SendCoins() { require.NoError(keeper.SendCoinsFromModuleToAccount(ctx, banktypes.MintModuleName, holderAcc.GetAddress(), initCoins)) authKeeper.EXPECT().GetModuleAddress("").Return(nil) - require.Panics(func() { - _ = keeper.SendCoinsFromModuleToModule(ctx, "", holderAcc.GetName(), initCoins) - }) + err := keeper.SendCoinsFromModuleToModule(ctx, "", holderAcc.GetName(), initCoins) + require.Error(err) authKeeper.EXPECT().GetModuleAddress(burnerAcc.Name).Return(burnerAcc.GetAddress()) authKeeper.EXPECT().GetModuleAccount(ctx, "").Return(nil) - require.Panics(func() { - _ = keeper.SendCoinsFromModuleToModule(ctx, authtypes.Burner, "", initCoins) - }) + err = keeper.SendCoinsFromModuleToModule(ctx, authtypes.Burner, "", initCoins) + require.Error(err) authKeeper.EXPECT().GetModuleAddress("").Return(nil) - require.Panics(func() { - _ = keeper.SendCoinsFromModuleToAccount(ctx, "", baseAcc.GetAddress(), initCoins) - }) + err = keeper.SendCoinsFromModuleToAccount(ctx, "", baseAcc.GetAddress(), initCoins) + require.Error(err) authKeeper.EXPECT().GetModuleAddress(holderAcc.Name).Return(holderAcc.GetAddress()) authKeeper.EXPECT().GetAccount(suite.ctx, holderAcc.GetAddress()).Return(holderAcc) @@ -508,16 +502,21 @@ func (suite *KeeperTestSuite) TestSupply_MintCoins() { require.NoError(err) authKeeper.EXPECT().GetModuleAccount(ctx, "").Return(nil) - require.Panics(func() { _ = keeper.MintCoins(ctx, "", initCoins) }, "no module account") + err = keeper.MintCoins(ctx, "", initCoins) + require.Error(err) + require.ErrorContains(err, "module account does not exist") suite.mockMintCoins(burnerAcc) - require.Panics(func() { _ = keeper.MintCoins(ctx, authtypes.Burner, initCoins) }, "invalid permission") + err = keeper.MintCoins(ctx, authtypes.Burner, initCoins) + require.Error(err) + require.ErrorContains(err, fmt.Sprintf("module account %s does not have permissions to mint tokens: unauthorized", authtypes.Burner)) suite.mockMintCoins(minterAcc) require.Error(keeper.MintCoins(ctx, authtypes.Minter, sdk.Coins{sdk.Coin{Denom: "denom", Amount: math.NewInt(-10)}}), "insufficient coins") authKeeper.EXPECT().GetModuleAccount(ctx, randomPerm).Return(nil) - require.Panics(func() { _ = keeper.MintCoins(ctx, randomPerm, initCoins) }) + err = keeper.MintCoins(ctx, randomPerm, initCoins) + require.Error(err) suite.mockMintCoins(minterAcc) require.NoError(keeper.MintCoins(ctx, authtypes.Minter, initCoins)) diff --git a/x/bank/keeper/send.go b/x/bank/keeper/send.go index eddc4b99e511..22b03e225357 100644 --- a/x/bank/keeper/send.go +++ b/x/bank/keeper/send.go @@ -178,7 +178,7 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input, sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeTransfer, - sdk.NewAttribute(types.AttributeKeyRecipient, outAddress.String()), + sdk.NewAttribute(types.AttributeKeyRecipient, out.Address), sdk.NewAttribute(sdk.AttributeKeyAmount, out.Coins.String()), ), ) @@ -226,13 +226,20 @@ func (k BaseSendKeeper) SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccA k.ak.SetAccount(ctx, k.ak.NewAccountWithAddress(ctx, toAddr)) } - // bech32 encoding is expensive! Only do it once for fromAddr - fromAddrString := fromAddr.String() + fromAddrString, err := k.ak.AddressCodec().BytesToString(fromAddr) + if err != nil { + return err + } + toAddrString, err := k.ak.AddressCodec().BytesToString(toAddr) + if err != nil { + return err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeTransfer, - sdk.NewAttribute(types.AttributeKeyRecipient, toAddr.String()), + sdk.NewAttribute(types.AttributeKeyRecipient, toAddrString), sdk.NewAttribute(types.AttributeKeySender, fromAddrString), sdk.NewAttribute(sdk.AttributeKeyAmount, amt.String()), ), @@ -279,9 +286,13 @@ func (k BaseSendKeeper) subUnlockedCoins(ctx context.Context, addr sdk.AccAddres } } + addrStr, err := k.ak.AddressCodec().BytesToString(addr) + if err != nil { + return err + } sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx.EventManager().EmitEvent( - types.NewCoinSpentEvent(addr, amt), + types.NewCoinSpentEvent(addrStr, amt), ) return nil @@ -304,10 +315,15 @@ func (k BaseSendKeeper) addCoins(ctx context.Context, addr sdk.AccAddress, amt s } } + addrStr, err := k.ak.AddressCodec().BytesToString(addr) + if err != nil { + return err + } + // emit coin received event sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx.EventManager().EmitEvent( - types.NewCoinReceivedEvent(addr, amt), + types.NewCoinReceivedEvent(addrStr, amt), ) return nil @@ -357,7 +373,11 @@ func (k BaseSendKeeper) IsSendEnabledCoin(ctx context.Context, coin sdk.Coin) bo // BlockedAddr checks if a given address is restricted from // receiving funds. func (k BaseSendKeeper) BlockedAddr(addr sdk.AccAddress) bool { - return k.blockedAddrs[addr.String()] + addrStr, err := k.ak.AddressCodec().BytesToString(addr) + if err != nil { + panic(err) + } + return k.blockedAddrs[addrStr] } // GetBlockedAddresses returns the full list of addresses restricted from receiving funds. diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index 32adceb96e28..89670938002d 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -119,7 +119,11 @@ func (k BaseViewKeeper) GetAccountsBalances(ctx context.Context) []types.Balance mapAddressToBalancesIdx := make(map[string]int) k.IterateAllBalances(ctx, func(addr sdk.AccAddress, balance sdk.Coin) bool { - idx, ok := mapAddressToBalancesIdx[addr.String()] + addrStr, err := k.ak.AddressCodec().BytesToString(addr) + if err != nil { + panic(err) + } + idx, ok := mapAddressToBalancesIdx[addrStr] if ok { // address is already on the set of accounts balances balances[idx].Coins = balances[idx].Coins.Add(balance) @@ -128,11 +132,11 @@ func (k BaseViewKeeper) GetAccountsBalances(ctx context.Context) []types.Balance } accountBalance := types.Balance{ - Address: addr.String(), + Address: addrStr, Coins: sdk.NewCoins(balance), } balances = append(balances, accountBalance) - mapAddressToBalancesIdx[addr.String()] = len(balances) - 1 + mapAddressToBalancesIdx[addrStr] = len(balances) - 1 return false }) diff --git a/x/bank/module.go b/x/bank/module.go index 77397d8acd1b..67889d2a5dfd 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -218,11 +218,19 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { blockedAddresses := make(map[string]bool) if len(in.Config.BlockedModuleAccountsOverride) > 0 { for _, moduleName := range in.Config.BlockedModuleAccountsOverride { - blockedAddresses[authtypes.NewModuleAddress(moduleName).String()] = true + addrStr, err := in.AccountKeeper.AddressCodec().BytesToString(authtypes.NewModuleAddress(moduleName)) + if err != nil { + panic(err) + } + blockedAddresses[addrStr] = true } } else { for _, permission := range in.AccountKeeper.GetModulePermissions() { - blockedAddresses[permission.GetAddress().String()] = true + addrStr, err := in.AccountKeeper.AddressCodec().BytesToString(permission.GetAddress()) + if err != nil { + panic(err) + } + blockedAddresses[addrStr] = true } } @@ -232,12 +240,17 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } + authStr, err := in.AccountKeeper.AddressCodec().BytesToString(authority) + if err != nil { + panic(err) + } + bankKeeper := keeper.NewBaseKeeper( in.Cdc, in.StoreService, in.AccountKeeper, blockedAddresses, - authority.String(), + authStr, in.Logger, ) m := NewAppModule(in.Cdc, bankKeeper, in.AccountKeeper) diff --git a/x/bank/simulation/operations.go b/x/bank/simulation/operations.go index ec6bb4535e59..0c9c6269101f 100644 --- a/x/bank/simulation/operations.go +++ b/x/bank/simulation/operations.go @@ -78,15 +78,22 @@ func SimulateMsgSend( if err := bk.IsSendEnabledCoins(ctx, coins...); err != nil { return simtypes.NoOpMsg(types.ModuleName, msgType, err.Error()), nil, nil } - if skip { return simtypes.NoOpMsg(types.ModuleName, msgType, "skip all transfers"), nil, nil } - msg := types.NewMsgSend(from.Address, to.Address, coins) - - err := sendMsgSend(r, app, txGen, bk, ak, msg, ctx, chainID, []cryptotypes.PrivKey{from.PrivKey}) + fromstr, err := ak.AddressCodec().BytesToString(from.Address) + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, msgType, err.Error()), nil, nil + } + tostr, err := ak.AddressCodec().BytesToString(to.Address) if err != nil { + return simtypes.NoOpMsg(types.ModuleName, msgType, err.Error()), nil, nil + } + + msg := types.NewMsgSend(fromstr, tostr, coins) + + if err := sendMsgSend(r, app, txGen, bk, ak, msg, ctx, chainID, []cryptotypes.PrivKey{from.PrivKey}); err != nil { return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "invalid transfers"), nil, err } @@ -100,7 +107,7 @@ func SimulateMsgSendToModuleAccount( txGen client.TxConfig, ak types.AccountKeeper, bk keeper.Keeper, - moduleAccCount int, + moduleAccount int, ) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, @@ -108,7 +115,7 @@ func SimulateMsgSendToModuleAccount( ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { msgType := sdk.MsgTypeURL(&types.MsgSend{}) from := accs[0] - to := getModuleAccounts(ak, ctx, moduleAccCount)[0] + to := getModuleAccounts(ak, ctx, moduleAccount)[0] spendable := bk.SpendableCoins(ctx, from.Address) coins := simtypes.RandSubsetCoins(r, spendable) @@ -116,19 +123,23 @@ func SimulateMsgSendToModuleAccount( if len(coins) == 0 { return simtypes.NoOpMsg(types.ModuleName, msgType, "empty coins slice"), nil, nil } - // Check send_enabled status of each coin denom if err := bk.IsSendEnabledCoins(ctx, coins...); err != nil { return simtypes.NoOpMsg(types.ModuleName, msgType, err.Error()), nil, nil } - - msg := types.NewMsgSend(from.Address, to.Address, coins) - - err := sendMsgSend(r, app, txGen, bk, ak, msg, ctx, chainID, []cryptotypes.PrivKey{from.PrivKey}) + fromstr, err := ak.AddressCodec().BytesToString(from.Address) if err != nil { - return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "invalid transfers"), nil, err + return simtypes.NoOpMsg(types.ModuleName, msgType, err.Error()), nil, nil } + tostr, err := ak.AddressCodec().BytesToString(to.Address) + if err != nil { + return simtypes.NoOpMsg(types.ModuleName, msgType, err.Error()), nil, nil + } + msg := types.NewMsgSend(fromstr, tostr, coins) + if err := sendMsgSend(r, app, txGen, bk, ak, msg, ctx, chainID, []cryptotypes.PrivKey{from.PrivKey}); err != nil { + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "invalid transfers"), nil, err + } return simtypes.NewOperationMsg(msg, true, ""), nil, nil } } @@ -145,7 +156,7 @@ func sendMsgSend( err error ) - from, err := sdk.AccAddressFromBech32(msg.FromAddress) + from, err := ak.AddressCodec().StringToBytes(msg.FromAddress) if err != nil { return err } @@ -279,7 +290,7 @@ func SimulateMsgMultiSendToModuleAccount( txGen client.TxConfig, ak types.AccountKeeper, bk keeper.Keeper, - moduleAccCount int, + moduleAccount int, ) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, @@ -287,7 +298,7 @@ func SimulateMsgMultiSendToModuleAccount( ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { msgType := sdk.MsgTypeURL(&types.MsgMultiSend{}) inputs := make([]types.Input, 2) - outputs := make([]types.Output, moduleAccCount) + outputs := make([]types.Output, moduleAccount) // collect signer privKeys privs := make([]cryptotypes.PrivKey, len(inputs)) var totalSentCoins sdk.Coins @@ -302,7 +313,7 @@ func SimulateMsgMultiSendToModuleAccount( if err := bk.IsSendEnabledCoins(ctx, totalSentCoins...); err != nil { return simtypes.NoOpMsg(types.ModuleName, msgType, err.Error()), nil, nil } - moduleAccounts := getModuleAccounts(ak, ctx, moduleAccCount) + moduleAccounts := getModuleAccounts(ak, ctx, moduleAccount) for i := range outputs { var outCoins sdk.Coins // split total sent coins into random subsets for output @@ -426,10 +437,10 @@ func randomSendFields( return from, to, sendCoins, false } -func getModuleAccounts(ak types.AccountKeeper, ctx sdk.Context, moduleAccCount int) []simtypes.Account { - moduleAccounts := make([]simtypes.Account, moduleAccCount) +func getModuleAccounts(ak types.AccountKeeper, ctx sdk.Context, moduleAccount int) []simtypes.Account { + moduleAccounts := make([]simtypes.Account, moduleAccount) - for i := 0; i < moduleAccCount; i++ { + for i := 0; i < moduleAccount; i++ { acc := ak.GetModuleAccount(ctx, distributionModuleName) mAcc := simtypes.Account{ Address: acc.GetAddress(), diff --git a/x/bank/simulation/operations_test.go b/x/bank/simulation/operations_test.go index df8a3dfa2296..5d4564af1f11 100644 --- a/x/bank/simulation/operations_test.go +++ b/x/bank/simulation/operations_test.go @@ -148,17 +148,14 @@ func (suite *SimTestSuite) TestSimulateMsgMultiSend() { } func (suite *SimTestSuite) TestSimulateModuleAccountMsgSend() { - const ( - accCount = 1 - moduleAccCount = 1 - ) + const moduleAccount = 1 s := rand.NewSource(1) r := rand.New(s) - accounts := suite.getTestingAccounts(r, accCount) + accounts := suite.getTestingAccounts(r, 1) // execute operation - op := simulation.SimulateMsgSendToModuleAccount(suite.txConfig, suite.accountKeeper, suite.bankKeeper, moduleAccCount) + op := simulation.SimulateMsgSendToModuleAccount(suite.txConfig, suite.accountKeeper, suite.bankKeeper, moduleAccount) s = rand.NewSource(1) r = rand.New(s) @@ -176,17 +173,14 @@ func (suite *SimTestSuite) TestSimulateModuleAccountMsgSend() { } func (suite *SimTestSuite) TestSimulateMsgMultiSendToModuleAccount() { - const ( - accCount = 2 - mAccCount = 2 - ) + const mAccount = 2 s := rand.NewSource(1) r := rand.New(s) - accounts := suite.getTestingAccounts(r, accCount) + accounts := suite.getTestingAccounts(r, 2) // execute operation - op := simulation.SimulateMsgMultiSendToModuleAccount(suite.txConfig, suite.accountKeeper, suite.bankKeeper, mAccCount) + op := simulation.SimulateMsgMultiSendToModuleAccount(suite.txConfig, suite.accountKeeper, suite.bankKeeper, mAccount) operationMsg, futureOperations, err := op(r, suite.app.BaseApp, suite.ctx, accounts, "") suite.Require().Error(err) diff --git a/x/bank/types/events.go b/x/bank/types/events.go index 098eebc37251..d26c4d8f342c 100644 --- a/x/bank/types/events.go +++ b/x/bank/types/events.go @@ -24,37 +24,37 @@ const ( ) // NewCoinSpentEvent constructs a new coin spent sdk.Event -func NewCoinSpentEvent(spender sdk.AccAddress, amount sdk.Coins) sdk.Event { +func NewCoinSpentEvent(spender string, amount sdk.Coins) sdk.Event { return sdk.NewEvent( EventTypeCoinSpent, - sdk.NewAttribute(AttributeKeySpender, spender.String()), + sdk.NewAttribute(AttributeKeySpender, spender), sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), ) } // NewCoinReceivedEvent constructs a new coin received sdk.Event -func NewCoinReceivedEvent(receiver sdk.AccAddress, amount sdk.Coins) sdk.Event { +func NewCoinReceivedEvent(receiver string, amount sdk.Coins) sdk.Event { return sdk.NewEvent( EventTypeCoinReceived, - sdk.NewAttribute(AttributeKeyReceiver, receiver.String()), + sdk.NewAttribute(AttributeKeyReceiver, receiver), sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), ) } // NewCoinMintEvent construct a new coin minted sdk.Event -func NewCoinMintEvent(minter sdk.AccAddress, amount sdk.Coins) sdk.Event { +func NewCoinMintEvent(minter string, amount sdk.Coins) sdk.Event { return sdk.NewEvent( EventTypeCoinMint, - sdk.NewAttribute(AttributeKeyMinter, minter.String()), + sdk.NewAttribute(AttributeKeyMinter, minter), sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), ) } // NewCoinBurnEvent constructs a new coin burned sdk.Event -func NewCoinBurnEvent(burner sdk.AccAddress, amount sdk.Coins) sdk.Event { +func NewCoinBurnEvent(burner string, amount sdk.Coins) sdk.Event { return sdk.NewEvent( EventTypeCoinBurn, - sdk.NewAttribute(AttributeKeyBurner, burner.String()), + sdk.NewAttribute(AttributeKeyBurner, burner), sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()), ) } diff --git a/x/bank/types/msgs.go b/x/bank/types/msgs.go index 05a23c280e2b..9cda2bd45fb3 100644 --- a/x/bank/types/msgs.go +++ b/x/bank/types/msgs.go @@ -11,8 +11,8 @@ var ( ) // NewMsgSend - construct a msg to send coins from one account to another. -func NewMsgSend(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgSend { - return &MsgSend{FromAddress: fromAddr.String(), ToAddress: toAddr.String(), Amount: amount} +func NewMsgSend(fromAddr, toAddr string, amount sdk.Coins) *MsgSend { + return &MsgSend{FromAddress: fromAddr, ToAddress: toAddr, Amount: amount} } // NewMsgMultiSend - construct arbitrary multi-in, multi-out send msg. diff --git a/x/bank/types/msgs_test.go b/x/bank/types/msgs_test.go index 98fc399b67c6..a6c59826bebb 100644 --- a/x/bank/types/msgs_test.go +++ b/x/bank/types/msgs_test.go @@ -12,10 +12,8 @@ import ( ) func TestMsgSendGetSignBytes(t *testing.T) { - addr1 := sdk.AccAddress([]byte("input")) - addr2 := sdk.AccAddress([]byte("output")) coins := sdk.NewCoins(sdk.NewInt64Coin("atom", 10)) - msg := NewMsgSend(addr1, addr2, coins) + msg := NewMsgSend("cosmos1d9h8qat57ljhcm", "cosmos1da6hgur4wsmpnjyg", coins) res, err := codec.NewProtoCodec(types.NewInterfaceRegistry()).MarshalAminoJSON(msg) require.NoError(t, err) diff --git a/x/bank/types/querier.go b/x/bank/types/querier.go index 5303035c2b44..6a2dcb097432 100644 --- a/x/bank/types/querier.go +++ b/x/bank/types/querier.go @@ -31,8 +31,8 @@ func NewQuerySpendableBalancesRequest(addr sdk.AccAddress, req *query.PageReques // NewQuerySpendableBalanceByDenomRequest creates a new instance of a // QuerySpendableBalanceByDenomRequest. -func NewQuerySpendableBalanceByDenomRequest(addr sdk.AccAddress, denom string) *QuerySpendableBalanceByDenomRequest { - return &QuerySpendableBalanceByDenomRequest{Address: addr.String(), Denom: denom} +func NewQuerySpendableBalanceByDenomRequest(addr, denom string) *QuerySpendableBalanceByDenomRequest { + return &QuerySpendableBalanceByDenomRequest{Address: addr, Denom: denom} } // QueryTotalSupplyParams defines the params for the following queries: diff --git a/x/bank/types/restrictions_test.go b/x/bank/types/restrictions_test.go index 3964b2a11ddb..9f0813b2ab64 100644 --- a/x/bank/types/restrictions_test.go +++ b/x/bank/types/restrictions_test.go @@ -28,7 +28,7 @@ func NewMintingRestrictionTestHelper() *MintingRestrictionTestHelper { return &MintingRestrictionTestHelper{Calls: make([]*MintingRestrictionArgs, 0, 2)} } -// RecordCall makes note that the provided args were used as a funcion call. +// RecordCall makes note that the provided args were used as a function call. func (s *MintingRestrictionTestHelper) RecordCall(name string, coins sdk.Coins) { s.Calls = append(s.Calls, s.NewArgs(name, coins)) } @@ -412,7 +412,7 @@ func NewSendRestrictionTestHelper() *SendRestrictionTestHelper { return &SendRestrictionTestHelper{Calls: make([]*SendRestrictionArgs, 0, 2)} } -// RecordCall makes note that the provided args were used as a funcion call. +// RecordCall makes note that the provided args were used as a function call. func (s *SendRestrictionTestHelper) RecordCall(name string, fromAddr, toAddr sdk.AccAddress, coins sdk.Coins) { s.Calls = append(s.Calls, s.NewArgs(name, fromAddr, toAddr, coins)) } diff --git a/x/bank/types/send_authorization_test.go b/x/bank/types/send_authorization_test.go index 78e9f29f7e38..fbecc2300669 100644 --- a/x/bank/types/send_authorization_test.go +++ b/x/bank/types/send_authorization_test.go @@ -16,11 +16,12 @@ import ( ) var ( - coins1000 = sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(1000))) - coins500 = sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(500))) - fromAddr = sdk.AccAddress("_____from _____") - toAddr = sdk.AccAddress("_______to________") - unknownAddr = sdk.AccAddress("_____unknown_____") + coins1000 = sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(1000))) + coins500 = sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(500))) + toAddr = sdk.AccAddress("_______to________") + fromAddrStr = "cosmos1ta047h6lveex7mfqta047h6ln9jal0" + toAddrStr = "cosmos1ta047h6lta0hgm6lta047h6lta0stgm2m3" + unknownAddrStr = "cosmos1ta047h6lw4hxkmn0wah97h6lta0sml880l" ) func TestSendAuthorization(t *testing.T) { @@ -32,9 +33,7 @@ func TestSendAuthorization(t *testing.T) { t.Log("verify authorization returns valid method name") require.Equal(t, authorization.MsgTypeURL(), "/cosmos.bank.v1beta1.MsgSend") require.NoError(t, authorization.ValidateBasic()) - send := types.NewMsgSend(fromAddr, toAddr, coins1000) - - require.NoError(t, authorization.ValidateBasic()) + send := types.NewMsgSend(fromAddrStr, toAddrStr, coins1000) t.Log("verify updated authorization returns nil") resp, err := authorization.Accept(ctx, send) @@ -45,7 +44,7 @@ func TestSendAuthorization(t *testing.T) { authorization = types.NewSendAuthorization(coins1000, nil) require.Equal(t, authorization.MsgTypeURL(), "/cosmos.bank.v1beta1.MsgSend") require.NoError(t, authorization.ValidateBasic()) - send = types.NewMsgSend(fromAddr, toAddr, coins500) + send = types.NewMsgSend(fromAddrStr, toAddrStr, coins500) require.NoError(t, authorization.ValidateBasic()) resp, err = authorization.Accept(ctx, send) @@ -66,20 +65,20 @@ func TestSendAuthorization(t *testing.T) { authzWithAllowList := types.NewSendAuthorization(coins1000, allowList) require.Equal(t, authzWithAllowList.MsgTypeURL(), "/cosmos.bank.v1beta1.MsgSend") require.NoError(t, authorization.ValidateBasic()) - send = types.NewMsgSend(fromAddr, unknownAddr, coins500) + send = types.NewMsgSend(fromAddrStr, unknownAddrStr, coins500) require.NoError(t, authzWithAllowList.ValidateBasic()) resp, err = authzWithAllowList.Accept(ctx, send) require.False(t, resp.Accept) require.False(t, resp.Delete) require.Nil(t, resp.Updated) require.Error(t, err) - require.Contains(t, err.Error(), fmt.Sprintf("cannot send to %s address", unknownAddr)) + require.Contains(t, err.Error(), fmt.Sprintf("cannot send to %s address", unknownAddrStr)) t.Log("send to address in allow list") authzWithAllowList = types.NewSendAuthorization(coins1000, allowList) require.Equal(t, authzWithAllowList.MsgTypeURL(), "/cosmos.bank.v1beta1.MsgSend") require.NoError(t, authorization.ValidateBasic()) - send = types.NewMsgSend(fromAddr, allowList[0], coins500) + send = types.NewMsgSend(fromAddrStr, toAddrStr, coins500) require.NoError(t, authzWithAllowList.ValidateBasic()) resp, err = authzWithAllowList.Accept(ctx, send) require.NoError(t, err) @@ -92,17 +91,17 @@ func TestSendAuthorization(t *testing.T) { authzWithAllowList = types.NewSendAuthorization(coins1000, allowList) require.Equal(t, authzWithAllowList.MsgTypeURL(), "/cosmos.bank.v1beta1.MsgSend") require.NoError(t, authorization.ValidateBasic()) - send = types.NewMsgSend(fromAddr, unknownAddr, coins1000) + send = types.NewMsgSend(fromAddrStr, unknownAddrStr, coins1000) require.NoError(t, authzWithAllowList.ValidateBasic()) resp, err = authzWithAllowList.Accept(ctx, send) require.Error(t, err) - require.Contains(t, err.Error(), fmt.Sprintf("cannot send to %s address", unknownAddr)) + require.Contains(t, err.Error(), fmt.Sprintf("cannot send to %s address", unknownAddrStr)) t.Log("send everything to address in allow list") authzWithAllowList = types.NewSendAuthorization(coins1000, allowList) require.Equal(t, authzWithAllowList.MsgTypeURL(), "/cosmos.bank.v1beta1.MsgSend") require.NoError(t, authorization.ValidateBasic()) - send = types.NewMsgSend(fromAddr, allowList[0], coins1000) + send = types.NewMsgSend(fromAddrStr, toAddrStr, coins1000) require.NoError(t, authzWithAllowList.ValidateBasic()) resp, err = authzWithAllowList.Accept(ctx, send) require.NoError(t, err) diff --git a/x/circuit/README.md b/x/circuit/README.md index 7386680e3ef3..a8fb8f4facc7 100644 --- a/x/circuit/README.md +++ b/x/circuit/README.md @@ -4,8 +4,29 @@ Circuit Breaker is a module that is meant to avoid a chain needing to halt/shut down in the presence of a vulnerability, instead the module will allow specific messages or all messages to be disabled. When operating a chain, if it is app specific then a halt of the chain is less detrimental, but if there are applications built on top of the chain then halting is expensive due to the disturbance to applications. +## How it works + Circuit Breaker works with the idea that an address or set of addresses have the right to block messages from being executed and/or included in the mempool. Any address with a permission is able to reset the circuit breaker for the message. +The transactions are checked and can be rejected at two points: + +* In `CircuitBreakerDecorator` [ante handler](https://docs.cosmos.network/main/learn/advanced/baseapp#antehandler): + +```go reference +https://github.com/cosmos/cosmos-sdk/blob/x/circuit/v0.1.0/x/circuit/ante/circuit.go#L27-L41 +``` + +* With a [message router check](https://docs.cosmos.network/main/learn/advanced/baseapp#msg-service-router): + +```go reference +https://github.com/cosmos/cosmos-sdk/blob/v0.50.1/baseapp/msg_service_router.go#L104-L115 +``` + +:::note +The `CircuitBreakerDecorator` works for most use cases, but does not check the inner messages of a transaction. This some transactions (such as `x/authz` transactions or some `x/gov` transactions) may pass the ante handler. **This does not affect the circuit breaker** as the message router check will still fail the transaction. +This tradeoff is to avoid introducing more dependencies in the `x/circuit` module. Chains can re-define the `CircuitBreakerDecorator` to check for inner messages if they wish to do so. +::: + ## State ### Accounts @@ -38,7 +59,6 @@ type Access struct { } ``` - ### Disable List List of type urls that are disabled. @@ -108,7 +128,7 @@ This message is expected to fail if: * if the type url is not disabled -## Events - list and describe event tags +## Events The circuit module emits the following events: @@ -143,9 +163,41 @@ The circuit module emits the following events: | message | action | reset_circuit_breaker | -## Keys - list of key prefixes used by the circuit module +## Keys * `AccountPermissionPrefix` - `0x01` * `DisableListPrefix` - `0x02` -## Client - list and describe CLI commands and gRPC and REST endpoints +## Client + +### CLI + +`x/circuit` module client provides the following CLI commands: + +```shell +$ tx circuit +Transactions commands for the circuit module + +Usage: + simd tx circuit [flags] + simd tx circuit [command] + +Available Commands: + authorize Authorize an account to trip the circuit breaker. + disable Disable a message from being executed + reset Enable a message to be executed +``` + +```shell +$ query circuit +Querying commands for the circuit module + +Usage: + simd query circuit [flags] + simd query circuit [command] + +Available Commands: + account Query a specific account's permissions + accounts Query all account permissions + disabled-list Query a list of all disabled message types +``` diff --git a/x/circuit/go.mod b/x/circuit/go.mod index c6f128a2ef02..479208b68a95 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -29,7 +29,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -110,7 +112,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -137,15 +139,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 5c66b9f3ed06..cbfb54444ddf 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -32,15 +32,15 @@ require ( gotest.tools/v3 v3.5.1 ) -require golang.org/x/sync v0.5.0 // indirect - require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.12.0 // 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -117,7 +117,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.17.0 // indirect @@ -142,14 +142,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect + golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 96c9ed61b115..14bd0321d3d1 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -149,7 +149,7 @@ func (k Keeper) AllocateTokensToValidator(ctx context.Context, val sdk.Validator } // sendDecimalPoolToCommunityPool sends the decimal pool to the community pool -// Any remainer stays in the decimal pool +// Any remainder stays in the decimal pool func (k Keeper) sendDecimalPoolToCommunityPool(ctx context.Context) error { feePool, err := k.FeePool.Get(ctx) if err != nil { diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index 8b9008a1e19f..36482b407b68 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -51,17 +51,17 @@ func (k Keeper) calculateDelegationRewardsBetween(ctx context.Context, val sdk.V ) (sdk.DecCoins, error) { // sanity check if startingPeriod > endingPeriod { - panic("startingPeriod cannot be greater than endingPeriod") + return sdk.DecCoins{}, fmt.Errorf("startingPeriod cannot be greater than endingPeriod") } // sanity check if stake.IsNegative() { - panic("stake should not be negative") + return sdk.DecCoins{}, fmt.Errorf("stake should not be negative") } valBz, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) if err != nil { - panic(err) + return sdk.DecCoins{}, err } // return staking * (ending - starting) @@ -77,7 +77,7 @@ func (k Keeper) calculateDelegationRewardsBetween(ctx context.Context, val sdk.V difference := ending.CumulativeRewardRatio.Sub(starting.CumulativeRewardRatio) if difference.IsAnyNegative() { - panic("negative rewards should not be possible") + return sdk.DecCoins{}, fmt.Errorf("negative rewards should not be possible") } // note: necessary to truncate so we don't allow withdrawing more rewards than owed rewards := difference.MulDecTruncate(stake) @@ -123,6 +123,7 @@ func (k Keeper) CalculateDelegationRewards(ctx context.Context, val sdk.Validato // Slashes this block happened after reward allocation, but we have to account // for them for the stake sanity check below. endingHeight := uint64(sdkCtx.BlockHeight()) + var iterErr error if endingHeight > startingHeight { err = k.IterateValidatorSlashEventsBetween(ctx, valAddr, startingHeight, endingHeight, func(height uint64, event types.ValidatorSlashEvent) (stop bool) { @@ -130,7 +131,8 @@ func (k Keeper) CalculateDelegationRewards(ctx context.Context, val sdk.Validato if endingPeriod > startingPeriod { delRewards, err := k.calculateDelegationRewardsBetween(ctx, val, startingPeriod, endingPeriod, stake) if err != nil { - panic(err) + iterErr = err + return true } rewards = rewards.Add(delRewards...) @@ -142,6 +144,9 @@ func (k Keeper) CalculateDelegationRewards(ctx context.Context, val sdk.Validato return false }, ) + if iterErr != nil { + return sdk.DecCoins{}, iterErr + } if err != nil { return sdk.DecCoins{}, err } @@ -178,10 +183,10 @@ func (k Keeper) CalculateDelegationRewards(ctx context.Context, val sdk.Validato if stake.LTE(currentStake.Add(marginOfErr)) { stake = currentStake } else { - panic(fmt.Sprintf("calculated final stake for delegator %s greater than current stake"+ + return sdk.DecCoins{}, fmt.Errorf("calculated final stake for delegator %s greater than current stake"+ "\n\tfinal stake:\t%s"+ "\n\tcurrent stake:\t%s", - del.GetDelegatorAddr(), stake, currentStake)) + del.GetDelegatorAddr(), stake, currentStake) } } diff --git a/x/distribution/keeper/grpc_query.go b/x/distribution/keeper/grpc_query.go index 48a66ba21fdc..16039f340f0f 100644 --- a/x/distribution/keeper/grpc_query.go +++ b/x/distribution/keeper/grpc_query.go @@ -264,27 +264,32 @@ func (k Querier) DelegationTotalRewards(ctx context.Context, req *types.QueryDel return nil, err } + var iterErr error err = k.stakingKeeper.IterateDelegations( ctx, delAdr, func(_ int64, del sdk.DelegationI) (stop bool) { valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(del.GetValidatorAddr()) if err != nil { - panic(err) + iterErr = err + return true } val, err := k.stakingKeeper.Validator(ctx, valAddr) if err != nil { - panic(err) + iterErr = err + return true } endingPeriod, err := k.IncrementValidatorPeriod(ctx, val) if err != nil { - panic(err) + iterErr = err + return true } delReward, err := k.CalculateDelegationRewards(ctx, val, del, endingPeriod) if err != nil { - panic(err) + iterErr = err + return true } delRewards = append(delRewards, types.NewDelegationDelegatorReward(del.GetValidatorAddr(), delReward)) @@ -292,6 +297,9 @@ func (k Querier) DelegationTotalRewards(ctx context.Context, req *types.QueryDel return false }, ) + if iterErr != nil { + return nil, iterErr + } if err != nil { return nil, err } diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 51d45a50de59..fe4759add015 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -34,7 +34,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect @@ -114,7 +116,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -140,15 +142,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index e50f992e7a60..5c075d92ef08 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -36,7 +36,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -117,7 +119,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -143,15 +145,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index aea59e70ec9d..97a980f989c5 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -639,8 +641,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -801,6 +803,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/feegrant/migrations/v2/keys.go b/x/feegrant/migrations/v2/keys.go index b7aee7300da0..f89f0c98d042 100644 --- a/x/feegrant/migrations/v2/keys.go +++ b/x/feegrant/migrations/v2/keys.go @@ -24,7 +24,7 @@ var ( // Key format: // - <0x01> func FeeAllowancePrefixQueue(exp *time.Time, granterAddrBz []byte) []byte { - // no need of appending len(exp_bytes) here, `FormatTimeBytes` gives const length everytime. + // no need of appending len(exp_bytes) here, `FormatTimeBytes` gives const length every time. var key []byte key = append(key, FeeAllowanceQueueKeyPrefix...) key = append(key, sdk.FormatTimeBytes(*exp)...) diff --git a/x/genutil/client/cli/genaccount_test.go b/x/genutil/client/cli/genaccount_test.go index 6f46a4bf4a13..fd533d2fcaa3 100644 --- a/x/genutil/client/cli/genaccount_test.go +++ b/x/genutil/client/cli/genaccount_test.go @@ -54,7 +54,7 @@ func TestAddGenesisAccountCmd(t *testing.T) { }, { name: "with keyring", - addr: "ser", + addr: "set", denom: "1000atom", withKeyring: true, expectErr: false, diff --git a/x/genutil/gentx_test.go b/x/genutil/gentx_test.go index bf018712c0e2..bf4e8eebd173 100644 --- a/x/genutil/gentx_test.go +++ b/x/genutil/gentx_test.go @@ -17,6 +17,7 @@ import ( banktypes "cosmossdk.io/x/bank/types" stakingtypes "cosmossdk.io/x/staking/types" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -239,6 +240,13 @@ func (suite *GenTxTestSuite) TestDeliverGenTxs() { txBuilder = suite.encodingConfig.TxConfig.NewTxBuilder() ) + ac := addresscodec.NewBech32Codec("cosmos") + + addr1Str, err := ac.BytesToString(addr1) + suite.Require().NoError(err) + addr2Str, err := ac.BytesToString(addr2) + suite.Require().NoError(err) + testCases := []struct { msg string malleate func() @@ -263,7 +271,7 @@ func (suite *GenTxTestSuite) TestDeliverGenTxs() { "success", func() { r := rand.New(rand.NewSource(time.Now().UnixNano())) - msg := banktypes.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 1)}) + msg := banktypes.NewMsgSend(addr1Str, addr2Str, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 1)}) tx, err := simtestutil.GenSignedMockTx( r, suite.encodingConfig.TxConfig, diff --git a/x/gov/CHANGELOG.md b/x/gov/CHANGELOG.md index f8265f6782bb..fff41b51bedd 100644 --- a/x/gov/CHANGELOG.md +++ b/x/gov/CHANGELOG.md @@ -31,4 +31,18 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Add SPAM vote proposals. +* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Add proposal types to proposals. + +### Improvements + +* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) Repurpose `govcliutils.NormalizeProposalType` to work for gov v1 proposal types. + ### API Breaking Changes + +* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) All functions that were taking an expedited bool parameter now take a `ProposalType` parameter instead. +* [#17496](https://github.com/cosmos/cosmos-sdk/pull/17496) in `x/gov/types/v1beta1/vote.go` `NewVote` was removed, constructing the struct is required for this type. + +### Deprecated + +* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) The field `v1.Proposal.Expedited` is deprecated and will be removed in the next release. diff --git a/x/gov/README.md b/x/gov/README.md index d26637ef151c..8aa290a570ab 100644 --- a/x/gov/README.md +++ b/x/gov/README.md @@ -2,6 +2,8 @@ sidebar_position: 1 --- + + # `x/gov` ## Abstract @@ -33,33 +35,33 @@ can be adapted to any Proof-Of-Stake blockchain by replacing *ATOM* with the nat staking token of the chain. * [Concepts](#concepts) - * [Proposal submission](#proposal-submission) - * [Deposit](#deposit) - * [Vote](#vote) - * [Software Upgrade](#software-upgrade) + * [Proposal submission](#proposal-submission) + * [Deposit](#deposit) + * [Vote](#vote) + * [Software Upgrade](#software-upgrade) * [State](#state) - * [Proposals](#proposals) - * [Parameters and base types](#parameters-and-base-types) - * [Deposit](#deposit-1) - * [ValidatorGovInfo](#validatorgovinfo) - * [Stores](#stores) - * [Proposal Processing Queue](#proposal-processing-queue) - * [Legacy Proposal](#legacy-proposal) + * [Proposals](#proposals) + * [Parameters and base types](#parameters-and-base-types) + * [Deposit](#deposit-1) + * [ValidatorGovInfo](#validatorgovinfo) + * [Stores](#stores) + * [Proposal Processing Queue](#proposal-processing-queue) + * [Legacy Proposal](#legacy-proposal) * [Messages](#messages) - * [Proposal Submission](#proposal-submission-1) - * [Deposit](#deposit-2) - * [Vote](#vote-1) + * [Proposal Submission](#proposal-submission-1) + * [Deposit](#deposit-2) + * [Vote](#vote-1) * [Events](#events) - * [EndBlocker](#endblocker) - * [Handlers](#handlers) + * [EndBlocker](#endblocker) + * [Handlers](#handlers) * [Parameters](#parameters) * [Client](#client) - * [CLI](#cli) - * [gRPC](#grpc) - * [REST](#rest) + * [CLI](#cli) + * [gRPC](#grpc) + * [REST](#rest) * [Metadata](#metadata) - * [Proposal](#proposal-3) - * [Vote](#vote-5) + * [Proposal](#proposal-3) + * [Vote](#vote-5) * [Future Improvements](#future-improvements) ## Concepts @@ -231,19 +233,19 @@ Later, we may add permissioned keys that could only sign txs from certain module #### Burnable Params -There are three parameters that define if the deposit of a proposal should be burned or returned to the depositors. +There are three parameters that define if the deposit of a proposal should be burned or returned to the depositors. -* `BurnVoteVeto` burns the proposal deposit if the proposal gets vetoed. +* `BurnVoteVeto` burns the proposal deposit if the proposal gets vetoed. * `BurnVoteQuorum` burns the proposal deposit if the proposal deposit if the vote does not reach quorum. -* `BurnProposalDepositPrevote` burns the proposal deposit if it does not enter the voting phase. +* `BurnProposalDepositPrevote` burns the proposal deposit if it does not enter the voting phase. -> Note: These parameters are modifiable via governance. +> Note: These parameters are modifiable via governance. ## State ### Constitution -`Constitution` is found in the genesis state. It is a string field intended to be used to descibe the purpose of a particular blockchain, and its expected norms. A few examples of how the constitution field can be used: +`Constitution` is found in the genesis state. It is a string field intended to be used to describe the purpose of a particular blockchain, and its expected norms. A few examples of how the constitution field can be used: * define the purpose of the chain, laying a foundation for its future development * set expectations for delegators @@ -253,14 +255,14 @@ There are three parameters that define if the deposit of a proposal should be bu Since this is more of a social feature than a technical feature, we'll now get into some items that may have been useful to have in a genesis constitution: * What limitations on governance exist, if any? - * is it okay for the community to slash the wallet of a whale that they no longer feel that they want around? (viz: Juno Proposal 4 and 16) - * can governance "socially slash" a validator who is using unapproved MEV? (viz: commonwealth.im/osmosis) - * In the event of an economic emergency, what should validators do? - * Terra crash of May, 2022, saw validators choose to run a new binary with code that had not been approved by governance, because the governance token had been inflated to nothing. + * is it okay for the community to slash the wallet of a whale that they no longer feel that they want around? (viz: Juno Proposal 4 and 16) + * can governance "socially slash" a validator who is using unapproved MEV? (viz: commonwealth.im/osmosis) + * In the event of an economic emergency, what should validators do? + * Terra crash of May, 2022, saw validators choose to run a new binary with code that had not been approved by governance, because the governance token had been inflated to nothing. * What is the purpose of the chain, specifically? - * best example of this is the Cosmos hub, where different founding groups, have different interpertations of the purpose of the network. + * best example of this is the Cosmos hub, where different founding groups, have different interpertations of the purpose of the network. -This genesis entry, "constitution" hasn't been designed for existing chains, who should likely just ratify a constitution using their governance system. Instead, this is for new chains. It will allow for validators to have a much clearer idea of purpose and the expecations placed on them while operating thier nodes. Likewise, for community members, the constitution will give them some idea of what to expect from both the "chain team" and the validators, respectively. +This genesis entry, "constitution" hasn't been designed for existing chains, who should likely just ratify a constitution using their governance system. Instead, this is for new chains. It will allow for validators to have a much clearer idea of purpose and the expecations placed on them while operating their nodes. Likewise, for community members, the constitution will give them some idea of what to expect from both the "chain team" and the validators, respectively. This constitution is designed to be immutable, and placed only in genesis, though that could change over time by a pull request to the cosmos-sdk that allows for the constitution to be changed by governance. Communities whishing to make amendments to their original constitution should use the governance mechanism and a "signaling proposal" to do exactly that. @@ -358,13 +360,7 @@ const ( VoteNo = 0x2 VoteNoWithVeto = 0x3 VoteAbstain = 0x4 -) - -type ProposalType string - -const ( - ProposalTypePlainText = "Text" - ProposalTypeSoftwareUpgrade = "SoftwareUpgrade" + VoteSpam = 0x5 ) type ProposalStatus byte @@ -527,7 +523,7 @@ The `initialDeposit` must be strictly positive and conform to the accepted denom * Initialise `Proposal`'s attributes * Decrease balance of sender by `InitialDeposit` * If `MinDeposit` is reached: - * Push `proposalID` in `ProposalProcessingQueue` + * Push `proposalID` in `ProposalProcessingQueue` * Transfer `InitialDeposit` from the `Proposer` to the governance `ModuleAccount` ### Deposit @@ -551,7 +547,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/gov/v1/tx.pro * Add `deposit` of sender in `proposal.Deposits` * Increase `proposal.TotalDeposit` by sender's `deposit` * If `MinDeposit` is reached: - * Push `proposalID` in `ProposalProcessingQueueEnd` + * Push `proposalID` in `ProposalProcessingQueueEnd` * Transfer `Deposit` from the `proposer` to the governance `ModuleAccount` ### Vote @@ -654,7 +650,6 @@ The governance module contains the following parameters: | burn_vote_veto | bool | true | | min_initial_deposit_ratio | string | "0.1" | - **NOTE**: The governance module contains parameters that are objects unlike other modules. If only a subset of parameters are desired to be changed, only they need to be included and not the entire parameter object structure. @@ -2487,7 +2482,7 @@ Example Output: ## Metadata -The gov module has two locations for metadata where users can provide further context about the on-chain actions they are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the json structure and where the data should be stored. There are two important factors in making these recommendations. First, that the gov and group modules are consistent with one another, note the number of proposals made by all groups may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence in the consistency of metadata structure accross chains. +The gov module has two locations for metadata where users can provide further context about the on-chain actions they are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the json structure and where the data should be stored. There are two important factors in making these recommendations. First, that the gov and group modules are consistent with one another, note the number of proposals made by all groups may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence in the consistency of metadata structure across chains. ### Proposal diff --git a/x/gov/abci.go b/x/gov/abci.go index 79a69402b7e7..688619083dbc 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -84,7 +84,7 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) error { logger.Info( "proposal did not meet minimum deposit; deleted", "proposal", proposal.Id, - "expedited", proposal.Expedited, + "proposal_type", proposal.ProposalType, "title", proposal.Title, "min_deposit", sdk.NewCoins(proposal.GetMinDepositFromParams(params)...).String(), "total_deposit", sdk.NewCoins(proposal.TotalDeposit...).String(), @@ -131,7 +131,7 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) error { // the deposit at this point since the proposal is converted to regular. // As a result, the deposits are either deleted or refunded in all cases // EXCEPT when an expedited proposal fails. - if passes || !proposal.Expedited { + if passes || !(proposal.ProposalType == v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) { if burnDeposits { err = keeper.DeleteAndBurnDeposits(ctx, proposal.Id) } else { @@ -199,12 +199,13 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) error { tagValue = types.AttributeValueProposalFailed logMsg = fmt.Sprintf("passed, but msg %d (%s) failed on execution: %s", idx, sdk.MsgTypeURL(msg), err) } - case proposal.Expedited: + case proposal.ProposalType == v1.ProposalType_PROPOSAL_TYPE_EXPEDITED: // When expedited proposal fails, it is converted // to a regular proposal. As a result, the voting period is extended, and, // once the regular voting period expires again, the tally is repeated // according to the regular proposal rules. - proposal.Expedited = false + proposal.ProposalType = v1.ProposalType_PROPOSAL_TYPE_STANDARD + proposal.Expedited = false // can be removed as never read but kept for state coherence params, err := keeper.Params.Get(ctx) if err != nil { return false, err @@ -246,7 +247,7 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) error { "proposal tallied", "proposal", proposal.Id, "status", proposal.Status.String(), - "expedited", proposal.Expedited, + "proposal_type", proposal.ProposalType, "title", proposal.Title, "results", logMsg, ) @@ -317,7 +318,7 @@ func failUnsupportedProposal( logger.Info( "proposal failed to decode; deleted", "proposal", proposal.Id, - "expedited", proposal.Expedited, + "proposal_type", proposal.ProposalType, "title", proposal.Title, "results", errMsg, ) diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 7dc07a51c4fd..e6106fc1ccfa 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -17,6 +17,7 @@ import ( stakingkeeper "cosmossdk.io/x/staking/keeper" stakingtypes "cosmossdk.io/x/staking/types" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -30,7 +31,7 @@ func TestUnregisteredProposal_InactiveProposalFails(t *testing.T) { startTime, endTime := time.Now().Add(-4*time.Hour), ctx.BlockHeader().Time proposal, err := v1.NewProposal([]sdk.Msg{ &v1.Proposal{}, // invalid proposal message - }, 1, startTime, startTime, "", "Unsupported proposal", "Unsupported proposal", addrs[0], false) + }, 1, startTime, startTime, "", "Unsupported proposal", "Unsupported proposal", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) err = suite.GovKeeper.SetProposal(ctx, proposal) @@ -58,7 +59,7 @@ func TestUnregisteredProposal_ActiveProposalFails(t *testing.T) { startTime, endTime := time.Now().Add(-4*time.Hour), ctx.BlockHeader().Time proposal, err := v1.NewProposal([]sdk.Msg{ &v1.Proposal{}, // invalid proposal message - }, 1, startTime, startTime, "", "Unsupported proposal", "Unsupported proposal", addrs[0], false) + }, 1, startTime, startTime, "", "Unsupported proposal", "Unsupported proposal", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) proposal.Status = v1.StatusVotingPeriod proposal.VotingEndTime = &endTime @@ -97,7 +98,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) require.NoError(t, err) @@ -142,7 +143,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) require.NoError(t, err) @@ -165,7 +166,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) require.NoError(t, err) @@ -205,7 +206,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) require.NoError(t, err) @@ -234,15 +235,15 @@ func TestTickPassedDepositPeriod(t *testing.T) { func TestTickPassedVotingPeriod(t *testing.T) { testcases := []struct { - name string - expedited bool + name string + proposalType v1.ProposalType }{ { name: "regular - deleted", }, { - name: "expedited - converted to regular", - expedited: true, + name: "expedited - converted to regular", + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, }, } @@ -251,7 +252,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { suite := createTestSuite(t) app := suite.App ctx := app.BaseApp.NewContext(false) - depositMultiplier := getDepositMultiplier(tc.expedited) + depositMultiplier := getDepositMultiplier(tc.proposalType) addrs := simtestutil.AddTestAddrs(suite.BankKeeper, suite.StakingKeeper, ctx, 10, valTokens.Mul(math.NewInt(depositMultiplier))) SortAddresses(addrs) @@ -261,7 +262,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { checkActiveProposalsQueue(t, ctx, suite.GovKeeper) proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 5*depositMultiplier))} - newProposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{mkTestLegacyContent(t)}, proposalCoins, addrs[0].String(), "", "Proposal", "description of proposal", tc.expedited) + newProposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{mkTestLegacyContent(t)}, proposalCoins, addrs[0].String(), "", "Proposal", "description of proposal", tc.proposalType) require.NoError(t, err) res, err := govMsgSvr.SubmitProposal(ctx, newProposalMsg) @@ -282,7 +283,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { params, _ := suite.GovKeeper.Params.Get(ctx) votingPeriod := params.VotingPeriod - if tc.expedited { + if tc.proposalType == v1.ProposalType_PROPOSAL_TYPE_EXPEDITED { votingPeriod = params.ExpeditedVotingPeriod } @@ -300,7 +301,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { err = gov.EndBlocker(ctx, suite.GovKeeper) require.NoError(t, err) - if !tc.expedited { + if tc.proposalType != v1.ProposalType_PROPOSAL_TYPE_EXPEDITED { checkActiveProposalsQueue(t, ctx, suite.GovKeeper) return } @@ -311,7 +312,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { proposal, err = suite.GovKeeper.Proposals.Get(ctx, res.ProposalId) require.Nil(t, err) require.Equal(t, v1.StatusVotingPeriod, proposal.Status) - require.False(t, proposal.Expedited) + require.False(t, proposal.ProposalType == v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) require.Equal(t, proposal.VotingStartTime.Add(*params.VotingPeriod), *proposal.VotingEndTime) }) } @@ -319,15 +320,16 @@ func TestTickPassedVotingPeriod(t *testing.T) { func TestProposalPassedEndblocker(t *testing.T) { testcases := []struct { - name string - expedited bool + name string + proposalType v1.ProposalType }{ { - name: "regular", + name: "regular", + proposalType: v1.ProposalType_PROPOSAL_TYPE_STANDARD, }, { - name: "expedited", - expedited: true, + name: "expedited", + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, }, } @@ -336,7 +338,7 @@ func TestProposalPassedEndblocker(t *testing.T) { suite := createTestSuite(t) app := suite.App ctx := app.BaseApp.NewContext(false) - depositMultiplier := getDepositMultiplier(tc.expedited) + depositMultiplier := getDepositMultiplier(tc.proposalType) addrs := simtestutil.AddTestAddrs(suite.BankKeeper, suite.StakingKeeper, ctx, 10, valTokens.Mul(math.NewInt(depositMultiplier))) SortAddresses(addrs) @@ -353,7 +355,7 @@ func TestProposalPassedEndblocker(t *testing.T) { require.NotNil(t, macc) initialModuleAccCoins := suite.BankKeeper.GetAllBalances(ctx, macc.GetAddress()) - proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "title", "summary", proposer, tc.expedited) + proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{mkTestLegacyContent(t)}, "", "title", "summary", proposer, tc.proposalType) require.NoError(t, err) proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 10*depositMultiplier))} @@ -400,11 +402,17 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) { valAddr := sdk.ValAddress(addrs[0]) proposer := addrs[0] + ac := addresscodec.NewBech32Codec("cosmos") + addrStr, err := ac.BytesToString(authtypes.NewModuleAddress(types.ModuleName)) + require.NoError(t, err) + toAddrStr, err := ac.BytesToString(addrs[0]) + require.NoError(t, err) + createValidators(t, stakingMsgSvr, ctx, []sdk.ValAddress{valAddr}, []int64{10}) - _, err := suite.StakingKeeper.EndBlocker(ctx) + _, err = suite.StakingKeeper.EndBlocker(ctx) require.NoError(t, err) - msg := banktypes.NewMsgSend(authtypes.NewModuleAddress(types.ModuleName), addrs[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))) - proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msg}, "", "title", "summary", proposer, false) + msg := banktypes.NewMsgSend(addrStr, toAddrStr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000)))) + proposal, err := suite.GovKeeper.SubmitProposal(ctx, []sdk.Msg{msg}, "", "title", "summary", proposer, v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) proposalCoins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 10))) @@ -466,7 +474,7 @@ func TestExpeditedProposal_PassAndConversionToRegular(t *testing.T) { suite := createTestSuite(t) app := suite.App ctx := app.BaseApp.NewContext(false) - depositMultiplier := getDepositMultiplier(true) + depositMultiplier := getDepositMultiplier(v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) addrs := simtestutil.AddTestAddrs(suite.BankKeeper, suite.StakingKeeper, ctx, 3, valTokens.Mul(math.NewInt(depositMultiplier))) params, err := suite.GovKeeper.Params.Get(ctx) require.NoError(t, err) @@ -493,7 +501,7 @@ func TestExpeditedProposal_PassAndConversionToRegular(t *testing.T) { depositorInitialBalance := suite.BankKeeper.GetAllBalances(ctx, addrs[1]) proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, suite.StakingKeeper.TokensFromConsensusPower(ctx, 5*depositMultiplier))} - newProposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{}, proposalCoins, proposer.String(), "metadata", "title", "summary", true) + newProposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{}, proposalCoins, proposer.String(), "metadata", "title", "summary", v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) require.NoError(t, err) res, err := govMsgSvr.SubmitProposal(ctx, newProposalMsg) @@ -558,7 +566,7 @@ func TestExpeditedProposal_PassAndConversionToRegular(t *testing.T) { proposal, err = suite.GovKeeper.Proposals.Get(ctx, res.ProposalId) require.Nil(t, err) require.Equal(t, v1.StatusVotingPeriod, proposal.Status) - require.False(t, proposal.Expedited) + require.False(t, proposal.ProposalType == v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) require.Equal(t, proposal.VotingStartTime.Add(*params.VotingPeriod), *proposal.VotingEndTime) // We also want to make sure that the deposit is not refunded yet and is still present in the module account @@ -639,12 +647,13 @@ func createValidators(t *testing.T, stakingMsgSvr stakingtypes.MsgServer, ctx sd // With expedited proposal's minimum deposit set higher than the default deposit, we must // initialize and deposit an amount depositMultiplier times larger // than the regular min deposit amount. -func getDepositMultiplier(expedited bool) int64 { - if expedited { +func getDepositMultiplier(proposalType v1.ProposalType) int64 { + switch proposalType { + case v1.ProposalType_PROPOSAL_TYPE_EXPEDITED: return v1.DefaultMinExpeditedDepositTokensRatio + default: + return 1 } - - return 1 } func checkActiveProposalsQueue(t *testing.T, ctx sdk.Context, k *keeper.Keeper) { diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 6167a0bfd8f7..d63e0dc24118 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -111,7 +111,7 @@ Where proposal.json contains: "deposit": "10stake", "title": "My proposal", "summary": "A short summary of my proposal", - "expedited": false + "proposal_type": "standard", } metadata example: @@ -138,7 +138,7 @@ metadata example: return err } - msg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), proposal.Metadata, proposal.Title, proposal.Summary, proposal.Expedited) + msg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), proposal.Metadata, proposal.Title, proposal.Summary, proposal.proposalType) if err != nil { return fmt.Errorf("invalid message: %w", err) } diff --git a/x/gov/client/cli/util.go b/x/gov/client/cli/util.go index 908de47055a9..760a6344683a 100644 --- a/x/gov/client/cli/util.go +++ b/x/gov/client/cli/util.go @@ -4,12 +4,14 @@ import ( "encoding/json" "fmt" "os" + "strings" "github.com/spf13/cobra" "github.com/spf13/pflag" govutils "cosmossdk.io/x/gov/client/utils" govv1 "cosmossdk.io/x/gov/types/v1" + "cosmossdk.io/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -48,7 +50,10 @@ func parseSubmitLegacyProposal(fs *pflag.FlagSet) (*legacyProposal, error) { proposalType, _ := fs.GetString(FlagProposalType) proposal.Title, _ = fs.GetString(FlagTitle) proposal.Description, _ = fs.GetString(FlagDescription) - proposal.Type = govutils.NormalizeProposalType(proposalType) + + if strings.EqualFold(proposalType, "text") { + proposal.Type = v1beta1.ProposalTypeText + } proposal.Deposit, _ = fs.GetString(FlagDeposit) if err := proposal.validate(); err != nil { return nil, err @@ -83,12 +88,14 @@ func parseSubmitLegacyProposal(fs *pflag.FlagSet) (*legacyProposal, error) { // proposal defines the new Msg-based proposal. type proposal struct { // Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys. - Messages []json.RawMessage `json:"messages,omitempty"` - Metadata string `json:"metadata"` - Deposit string `json:"deposit"` - Title string `json:"title"` - Summary string `json:"summary"` - Expedited bool `json:"expedited"` + Messages []json.RawMessage `json:"messages,omitempty"` + Metadata string `json:"metadata"` + Deposit string `json:"deposit"` + Title string `json:"title"` + Summary string `json:"summary"` + ProposalTypeStr string `json:"proposal_type,omitempty"` + + proposalType govv1.ProposalType `json:"-"` } // parseSubmitProposal reads and parses the proposal. @@ -105,6 +112,12 @@ func parseSubmitProposal(cdc codec.Codec, path string) (proposal, []sdk.Msg, sdk return proposal, nil, nil, err } + proposalType := govv1.ProposalType_PROPOSAL_TYPE_STANDARD + if proposal.ProposalTypeStr != "" { + proposalType = govutils.NormalizeProposalType(proposal.ProposalTypeStr) + } + proposal.proposalType = proposalType + msgs := make([]sdk.Msg, len(proposal.Messages)) for i, anyJSON := range proposal.Messages { var msg sdk.Msg @@ -168,10 +181,14 @@ func ReadGovPropCmdFlags(proposer string, flagSet *pflag.FlagSet) (*govv1.MsgSub return nil, fmt.Errorf("could not read summary: %w", err) } - rv.Expedited, err = flagSet.GetBool(FlagExpedited) + expedited, err := flagSet.GetBool(FlagExpedited) if err != nil { return nil, fmt.Errorf("could not read expedited: %w", err) } + if expedited { + rv.Expedited = true + rv.ProposalType = govv1.ProposalType_PROPOSAL_TYPE_EXPEDITED + } rv.Proposer = proposer diff --git a/x/gov/client/cli/util_test.go b/x/gov/client/cli/util_test.go index 1fd3c4cb1802..bc8245df63aa 100644 --- a/x/gov/client/cli/util_test.go +++ b/x/gov/client/cli/util_test.go @@ -184,7 +184,7 @@ func TestParseSubmitProposal(t *testing.T) { "title": "My awesome title", "summary": "My awesome summary", "deposit": "1000test", - "expedited": true + "proposal_type": "expedited" } `, addr, addr, addr, addr, addr, base64.StdEncoding.EncodeToString(expectedMetadata))) @@ -223,7 +223,7 @@ func TestParseSubmitProposal(t *testing.T) { require.Equal(t, "My awesome description", textProp.Description) require.Equal(t, "My awesome title", proposal.Title) require.Equal(t, "My awesome summary", proposal.Summary) - require.Equal(t, true, proposal.Expedited) + require.Equal(t, v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, proposal.proposalType) err = okJSON.Close() require.Nil(t, err, "unexpected error") diff --git a/x/gov/client/utils/utils.go b/x/gov/client/utils/utils.go index 930fb7c0d788..7ac1c77f2156 100644 --- a/x/gov/client/utils/utils.go +++ b/x/gov/client/utils/utils.go @@ -3,26 +3,47 @@ package utils import ( "strings" - "cosmossdk.io/x/gov/types/v1beta1" + v1 "cosmossdk.io/x/gov/types/v1" ) // NormalizeVoteOption - normalize user specified vote option func NormalizeVoteOption(option string) string { - switch option { - case "Yes", "yes": - return v1beta1.OptionYes.String() + switch { + case strings.EqualFold(option, "yes"): + return v1.OptionYes.String() - case "Abstain", "abstain": - return v1beta1.OptionAbstain.String() + case strings.EqualFold(option, "abstain"): + return v1.OptionAbstain.String() - case "No", "no": - return v1beta1.OptionNo.String() + case strings.EqualFold(option, "no"): + return v1.OptionNo.String() - case "NoWithVeto", "no_with_veto", "no-with-veto": - return v1beta1.OptionNoWithVeto.String() + case strings.EqualFold(option, "nowithveto"): + return v1.OptionNoWithVeto.String() + case strings.EqualFold(option, "spam"): + return v1.OptionSpam.String() + } + + // extra check for no_with_veto + if option == "no_with_veto" || option == "no-with-veto" { + return v1.OptionNoWithVeto.String() + } + + return option +} + +// NormalizeProposalType - normalize user specified proposal type. +func NormalizeProposalType(proposalType string) v1.ProposalType { + switch proposalType { + case "Expedited", "expedited": + return v1.ProposalType_PROPOSAL_TYPE_EXPEDITED + case "MultipleChoice", "multiple_choice", "multiple-choice": + return v1.ProposalType_PROPOSAL_TYPE_MULTIPLE_CHOICE + case "Optimistic", "optimistic": + return v1.ProposalType_PROPOSAL_TYPE_OPTIMISTIC default: - return option + return v1.ProposalType_PROPOSAL_TYPE_STANDARD } } @@ -40,28 +61,17 @@ func NormalizeWeightedVoteOptions(options string) string { return strings.Join(newOptions, ",") } -// NormalizeProposalType - normalize user specified proposal type. -func NormalizeProposalType(proposalType string) string { - switch proposalType { - case "Text", "text": - return v1beta1.ProposalTypeText - - default: - return "" - } -} - // NormalizeProposalStatus - normalize user specified proposal status. func NormalizeProposalStatus(status string) string { switch status { case "DepositPeriod", "deposit_period": - return v1beta1.StatusDepositPeriod.String() + return v1.StatusDepositPeriod.String() case "VotingPeriod", "voting_period": - return v1beta1.StatusVotingPeriod.String() + return v1.StatusVotingPeriod.String() case "Passed", "passed": - return v1beta1.StatusPassed.String() + return v1.StatusPassed.String() case "Rejected", "rejected": - return v1beta1.StatusRejected.String() + return v1.StatusRejected.String() default: return status } diff --git a/x/gov/client/utils/utils_test.go b/x/gov/client/utils/utils_test.go index 1ff88f1f16dc..135d64c2b79e 100644 --- a/x/gov/client/utils/utils_test.go +++ b/x/gov/client/utils/utils_test.go @@ -15,31 +15,31 @@ func TestNormalizeWeightedVoteOptions(t *testing.T) { }{ "simple Yes": { options: "Yes", - normalized: "VOTE_OPTION_YES=1", + normalized: "VOTE_OPTION_ONE=1", }, "simple yes": { options: "yes", - normalized: "VOTE_OPTION_YES=1", + normalized: "VOTE_OPTION_ONE=1", }, "formal yes": { options: "yes=1", - normalized: "VOTE_OPTION_YES=1", + normalized: "VOTE_OPTION_ONE=1", }, "half yes half no": { options: "yes=0.5,no=0.5", - normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.5", + normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.5", }, "3 options": { options: "Yes=0.5,No=0.4,NoWithVeto=0.1", - normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.4,VOTE_OPTION_NO_WITH_VETO=0.1", + normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.4,VOTE_OPTION_FOUR=0.1", }, "zero weight option": { options: "Yes=0.5,No=0.5,NoWithVeto=0", - normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.5,VOTE_OPTION_NO_WITH_VETO=0", + normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.5,VOTE_OPTION_FOUR=0", }, "minus weight option": { options: "Yes=0.5,No=0.6,NoWithVeto=-0.1", - normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.6,VOTE_OPTION_NO_WITH_VETO=-0.1", + normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.6,VOTE_OPTION_FOUR=-0.1", }, "empty options": { options: "", diff --git a/x/gov/go.mod b/x/gov/go.mod index d750bc41ef0d..174399cf3ef2 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -39,7 +39,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -118,7 +120,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -143,14 +145,18 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sync v0.5.0 // indirect + golang.org/x/sync v0.5.0 golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/gov/go.sum b/x/gov/go.sum index ff01c1e55ea9..c15c4a1d170f 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -637,8 +639,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -799,6 +801,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 1e3a55ffda5b..e65b4d39087d 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -34,6 +34,8 @@ var ( _, _, addr = testdata.KeyTestPubAddr() govAcct = authtypes.NewModuleAddress(types.ModuleName) poolAcct = authtypes.NewModuleAddress(pooltypes.ModuleName) + govAcctStr = "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + addrStr = addr.String() TestProposal = getTestProposal() ) @@ -50,7 +52,7 @@ func getTestProposal() []sdk.Msg { } return []sdk.Msg{ - banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1000)))), + banktypes.NewMsgSend(govAcctStr, addrStr, sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1000)))), legacyProposalMsg, } } diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index c149ca560b5d..196fe346e590 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -281,7 +281,7 @@ func (keeper Keeper) RefundAndDeleteDeposits(ctx context.Context, proposalID uin // validateInitialDeposit validates if initial deposit is greater than or equal to the minimum // required at the time of proposal submission. This threshold amount is determined by // the deposit parameters. Returns nil on success, error otherwise. -func (keeper Keeper) validateInitialDeposit(ctx context.Context, params v1.Params, initialDeposit sdk.Coins, expedited bool) error { +func (keeper Keeper) validateInitialDeposit(ctx context.Context, params v1.Params, initialDeposit sdk.Coins, proposalType v1.ProposalType) error { if !initialDeposit.IsValid() || initialDeposit.IsAnyNegative() { return errors.Wrap(sdkerrors.ErrInvalidCoins, initialDeposit.String()) } @@ -295,9 +295,10 @@ func (keeper Keeper) validateInitialDeposit(ctx context.Context, params v1.Param } var minDepositCoins sdk.Coins - if expedited { + switch proposalType { + case v1.ProposalType_PROPOSAL_TYPE_EXPEDITED: minDepositCoins = params.ExpeditedMinDeposit - } else { + default: minDepositCoins = params.MinDeposit } diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 3def399e811b..79f7efd92742 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -24,15 +24,16 @@ const ( func TestDeposits(t *testing.T) { testcases := []struct { - name string - expedited bool + name string + proposalType v1.ProposalType }{ { - name: "regular", + name: "regular", + proposalType: v1.ProposalType_PROPOSAL_TYPE_STANDARD, }, { - name: "expedited", - expedited: true, + name: "expedited", + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, }, } @@ -46,7 +47,7 @@ func TestDeposits(t *testing.T) { // initialize and deposit an amount depositMultiplier times larger // than the regular min deposit amount. depositMultiplier := int64(1) - if tc.expedited { + if tc.proposalType == v1.ProposalType_PROPOSAL_TYPE_EXPEDITED { depositMultiplier = v1.DefaultMinExpeditedDepositTokensRatio } @@ -54,7 +55,7 @@ func TestDeposits(t *testing.T) { authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0], tc.expedited) + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0], tc.proposalType) require.NoError(t, err) proposalID := proposal.Id @@ -146,7 +147,7 @@ func TestDeposits(t *testing.T) { require.Equal(t, addr1Initial, bankKeeper.GetAllBalances(ctx, TestAddrs[1])) // Test delete and burn deposits - proposal, err = govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0], true) + proposal, err = govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0], v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) require.NoError(t, err) proposalID = proposal.Id _, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake) @@ -226,7 +227,7 @@ func TestDepositAmount(t *testing.T) { require.NoError(t, err) tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", testAddrs[0], false) + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", testAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) proposalID := proposal.Id @@ -343,7 +344,11 @@ func TestValidateInitialDeposit(t *testing.T) { err := govKeeper.Params.Set(ctx, params) require.NoError(t, err) - err = govKeeper.ValidateInitialDeposit(ctx, tc.initialDeposit, tc.expedited) + if tc.expedited { + err = govKeeper.ValidateInitialDeposit(ctx, tc.initialDeposit, v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) + } else { + err = govKeeper.ValidateInitialDeposit(ctx, tc.initialDeposit, v1.ProposalType_PROPOSAL_TYPE_STANDARD) + } if tc.expectError { require.Error(t, err) @@ -416,7 +421,7 @@ func TestChargeDeposit(t *testing.T) { require.NoError(t, err) tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0], false) + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", TestAddrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) proposalID := proposal.Id // deposit to proposal diff --git a/x/gov/keeper/export_test.go b/x/gov/keeper/export_test.go index f9db25240adb..1421e96781d1 100644 --- a/x/gov/keeper/export_test.go +++ b/x/gov/keeper/export_test.go @@ -1,14 +1,18 @@ package keeper -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + v1 "cosmossdk.io/x/gov/types/v1" + + sdk "github.com/cosmos/cosmos-sdk/types" +) // ValidateInitialDeposit is a helper function used only in deposit tests which returns the same // functionality of validateInitialDeposit private function. -func (k Keeper) ValidateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins, expedited bool) error { +func (k Keeper) ValidateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins, proposalType v1.ProposalType) error { params, err := k.Params.Get(ctx) if err != nil { return err } - return k.validateInitialDeposit(ctx, params, initialDeposit, expedited) + return k.validateInitialDeposit(ctx, params, initialDeposit, proposalType) } diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index efc6c63d5395..e92700dc2a23 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -58,7 +58,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposal() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], false) + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -139,7 +139,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposal() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], false) + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -155,7 +155,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposal() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], true) + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) @@ -216,7 +216,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { testProposal := []sdk.Msg{ v1.NewMsgVote(govAddress, uint64(i), v1.OptionYes, ""), } - proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "", "title", "summary", addrs[0], false) + proposal, err := suite.govKeeper.SubmitProposal(ctx, testProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NotEmpty(proposal) suite.Require().NoError(err) testProposals = append(testProposals, &proposal) @@ -415,7 +415,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryProposals() { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, govAcct.String()) suite.Require().NoError(err) - submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], false) + submittedProposal, err := suite.govKeeper.SubmitProposal(ctx, []sdk.Msg{msgContent}, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) suite.Require().NotEmpty(submittedProposal) }, @@ -496,7 +496,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVote() { "no votes present", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], false) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) req = &v1.QueryVoteRequest{ @@ -611,7 +611,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVote() { "no votes present", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], false) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) req = &v1beta1.QueryVoteRequest{ @@ -718,7 +718,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryVotes() { "create a proposal and get votes", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], false) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) req = &v1.QueryVotesRequest{ @@ -822,7 +822,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryVotes() { "create a proposal and get votes", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], false) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) req = &v1beta1.QueryVotesRequest{ @@ -1110,7 +1110,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposit() { "no deposits proposal", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], false) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) suite.Require().NotNil(proposal) @@ -1212,7 +1212,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryDeposit() { "no deposits proposal", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], false) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) suite.Require().NotNil(proposal) @@ -1303,7 +1303,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryDeposits() { "create a proposal and get deposits", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], true) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) suite.Require().NoError(err) req = &v1.QueryDepositsRequest{ @@ -1400,7 +1400,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryDeposits() { "create a proposal and get deposits", func() { var err error - proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], false) + proposal, err = suite.govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) req = &v1beta1.QueryDepositsRequest{ @@ -1502,6 +1502,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTallyResult() { AbstainCount: "1", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, SubmitTime: &propTime, VotingStartTime: &propTime, @@ -1518,6 +1519,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTallyResult() { AbstainCount: "1", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", } }, true, @@ -1544,6 +1546,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTallyResult() { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", } }, true, @@ -1570,6 +1573,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryTallyResult() { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", } }, true, @@ -1641,6 +1645,7 @@ func (suite *KeeperTestSuite) TestLegacyGRPCQueryTallyResult() { AbstainCount: "1", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, SubmitTime: &propTime, VotingStartTime: &propTime, diff --git a/x/gov/keeper/hooks_test.go b/x/gov/keeper/hooks_test.go index 1b7fb616f0fd..85d187294c7a 100644 --- a/x/gov/keeper/hooks_test.go +++ b/x/gov/keeper/hooks_test.go @@ -75,7 +75,7 @@ func TestHooks(t *testing.T) { require.False(t, govHooksReceiver.AfterProposalVotingPeriodEndedValid) tp := TestProposal - _, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + _, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) require.True(t, govHooksReceiver.AfterProposalSubmissionValid) @@ -88,7 +88,7 @@ func TestHooks(t *testing.T) { require.True(t, govHooksReceiver.AfterProposalFailedMinDepositValid) - p2, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + p2, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) activated, err := govKeeper.AddDeposit(ctx, p2.Id, addrs[0], minDeposit) diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index da7f83e62d85..f53406677427 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -89,17 +89,17 @@ func TestIncrementProposalNumber(t *testing.T) { require.NoError(t, err) tp := TestProposal - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, false) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, false) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, true) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, true) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, false) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) - proposal6, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, false) + proposal6, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) require.Equal(t, uint64(6), proposal6.Id) @@ -116,7 +116,7 @@ func TestProposalQueues(t *testing.T) { // create test proposals tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, false) + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", addrBz, v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) has, err := govKeeper.InactiveProposalsQueue.Has(ctx, collections.Join(*proposal.DepositEndTime, proposal.Id)) diff --git a/x/gov/keeper/migrations.go b/x/gov/keeper/migrations.go index b91df665b104..5b95c821025c 100644 --- a/x/gov/keeper/migrations.go +++ b/x/gov/keeper/migrations.go @@ -2,6 +2,7 @@ package keeper import ( v5 "cosmossdk.io/x/gov/migrations/v5" + v6 "cosmossdk.io/x/gov/migrations/v6" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -37,3 +38,8 @@ func (m Migrator) Migrate3to4(ctx sdk.Context) error { func (m Migrator) Migrate4to5(ctx sdk.Context) error { return v5.MigrateStore(ctx, m.keeper.storeService, m.keeper.cdc, m.keeper.Constitution) } + +// Migrate4to5 migrates from version 5 to 6. +func (m Migrator) Migrate5to6(ctx sdk.Context) error { + return v6.MigrateStore(ctx, m.keeper.Proposals) +} diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 87c5c4c34720..2bbf32e76a32 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -76,7 +76,12 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos return nil, fmt.Errorf("failed to get governance parameters: %w", err) } - if err := k.validateInitialDeposit(ctx, params, initialDeposit, msg.Expedited); err != nil { + proposalType := msg.ProposalType + if msg.Expedited { // checking for backward compatibility + proposalType = v1.ProposalType_PROPOSAL_TYPE_EXPEDITED + } + + if err := k.validateInitialDeposit(ctx, params, initialDeposit, proposalType); err != nil { return nil, err } @@ -84,7 +89,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos return nil, err } - proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata, msg.Title, msg.Summary, proposer, msg.Expedited) + proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata, msg.Title, msg.Summary, proposer, proposalType) if err != nil { return nil, err } @@ -321,7 +326,7 @@ func (k legacyMsgServer) SubmitProposal(goCtx context.Context, msg *v1beta1.MsgS "", msg.GetContent().GetTitle(), msg.GetContent().GetDescription(), - false, // legacy proposals cannot be expedited + v1.ProposalType_PROPOSAL_TYPE_STANDARD, // legacy proposals can only be standard ) if err != nil { return nil, err diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 0c8be118bc42..a9156f3f8527 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -51,7 +51,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { strings.Repeat("1", 100), "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -66,7 +66,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -81,7 +81,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -96,7 +96,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -111,7 +111,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "{\"title\":\"Proposal\", \"description\":\"description of proposal\"}", "Proposal2", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -126,7 +126,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "{\"title\":\"Proposal\", \"description\":\"description of proposal\"}", "Proposal", "description", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -141,7 +141,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "Metadata", strings.Repeat("1", 256), "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -156,7 +156,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { strings.Repeat("1", 256), "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -171,7 +171,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", strings.Repeat("1", 10201), - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -186,7 +186,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -201,7 +201,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -216,7 +216,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -231,7 +231,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -246,7 +246,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: true, @@ -261,7 +261,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: false, @@ -275,7 +275,7 @@ func (suite *KeeperTestSuite) TestMsgSubmitProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) }, expErr: false, @@ -315,7 +315,7 @@ func (suite *KeeperTestSuite) TestMsgCancelProposal() { coins, proposer.String(), "", "title", "summary", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -364,7 +364,7 @@ func (suite *KeeperTestSuite) TestMsgCancelProposal() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -415,7 +415,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -436,7 +436,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { preRun: func() uint64 { return proposalID }, - option: v1.VoteOption_VOTE_OPTION_YES, + option: v1.VoteOption_VOTE_OPTION_ONE, voter: sdk.AccAddress{}, metadata: "", expErr: true, @@ -461,7 +461,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -470,7 +470,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { suite.Require().NotNil(res.ProposalId) return res.ProposalId }, - option: v1.VoteOption_VOTE_OPTION_YES, + option: v1.VoteOption_VOTE_OPTION_ONE, voter: proposer, metadata: "", expErr: true, @@ -480,7 +480,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { preRun: func() uint64 { return proposalID }, - option: v1.VoteOption_VOTE_OPTION_YES, + option: v1.VoteOption_VOTE_OPTION_ONE, voter: proposer, metadata: strings.Repeat("a", 300), expErr: true, @@ -490,7 +490,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { preRun: func() uint64 { return proposalID }, - option: v1.VoteOption_VOTE_OPTION_YES, + option: v1.VoteOption_VOTE_OPTION_ONE, voter: sdk.AccAddress(strings.Repeat("a", 300)), metadata: "", expErr: true, @@ -505,7 +505,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -514,7 +514,7 @@ func (suite *KeeperTestSuite) TestMsgVote() { suite.Require().NotNil(res.ProposalId) return res.ProposalId }, - option: v1.VoteOption_VOTE_OPTION_YES, + option: v1.VoteOption_VOTE_OPTION_ONE, voter: proposer, metadata: "", expErr: false, @@ -558,7 +558,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -624,7 +624,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_YES weight:"0.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_ONE weight:"0.000000000000000000" : invalid vote option`, }, "negative weight": { preRun: func() uint64 { @@ -636,7 +636,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_YES weight:"-1.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_ONE weight:"-1.000000000000000000" : invalid vote option`, }, "empty options": { preRun: func() uint64 { @@ -679,7 +679,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -688,7 +688,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { suite.Require().NotNil(res.ProposalId) return res.ProposalId }, - option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_YES), + option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_ONE), voter: proposer, metadata: "", expErr: true, @@ -698,7 +698,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { preRun: func() uint64 { return proposalID }, - option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_YES), + option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_ONE), voter: proposer, metadata: strings.Repeat("a", 300), expErr: true, @@ -708,7 +708,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { preRun: func() uint64 { return proposalID }, - option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_YES), + option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_ONE), voter: sdk.AccAddress(strings.Repeat("a", 300)), metadata: "", expErr: true, @@ -723,7 +723,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -732,7 +732,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { suite.Require().NotNil(res.ProposalId) return res.ProposalId }, - option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_YES), + option: v1.NewNonSplitVoteOption(v1.VoteOption_VOTE_OPTION_ONE), voter: proposer, metadata: "", expErr: false, @@ -746,7 +746,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -802,7 +802,7 @@ func (suite *KeeperTestSuite) TestMsgDeposit() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1012,7 +1012,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1058,7 +1058,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1092,7 +1092,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1145,7 +1145,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1229,7 +1229,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_YES weight:"0.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_ONE weight:"0.000000000000000000" : invalid vote option`, }, "negative weight": { preRun: func() uint64 { @@ -1244,7 +1244,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_YES weight:"-1.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_ONE weight:"-1.000000000000000000" : invalid vote option`, }, "empty options": { preRun: func() uint64 { @@ -1295,7 +1295,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1339,7 +1339,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1396,7 +1396,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgDeposit() { "", "Proposal", "description of proposal", - false, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, ) suite.Require().NoError(err) @@ -1781,7 +1781,7 @@ func (suite *KeeperTestSuite) TestSubmitProposal_InitialDeposit() { err := govKeeper.Params.Set(ctx, params) suite.Require().NoError(err) - msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test", "Proposal", "description of proposal", false) + msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test", "Proposal", "description of proposal", v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) // System under test diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 6750c5dea802..6d673824f3d4 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -17,15 +17,14 @@ import ( ) // SubmitProposal creates a new proposal given an array of messages -func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress, expedited bool) (v1.Proposal, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - +func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress, proposalType v1.ProposalType) (v1.Proposal, error) { // This method checks that all message metadata, summary and title // has te expected length defined in the module configuration. if err := keeper.validateProposalLengths(metadata, title, summary); err != nil { return v1.Proposal{}, err } + sdkCtx := sdk.UnwrapSDKContext(ctx) // Will hold a string slice of all Msg type URLs. msgs := []string{} @@ -90,7 +89,7 @@ func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, met submitTime := sdkCtx.HeaderInfo().Time depositPeriod := params.MaxDepositPeriod - proposal, err := v1.NewProposal(messages, proposalID, submitTime, submitTime.Add(*depositPeriod), metadata, title, summary, proposer, expedited) + proposal, err := v1.NewProposal(messages, proposalID, submitTime, submitTime.Add(*depositPeriod), metadata, title, summary, proposer, proposalType) if err != nil { return v1.Proposal{}, err } diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index 27cfeeaf55cc..e23dfbf20e4e 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -20,17 +20,20 @@ import ( // TODO(tip): remove this func (suite *KeeperTestSuite) TestGetSetProposal() { testCases := map[string]struct { - expedited bool + proposalType v1.ProposalType }{ - "regular proposal": {}, + "unspecified proposal type": {}, + "regular proposal": { + proposalType: v1.ProposalType_PROPOSAL_TYPE_STANDARD, + }, "expedited proposal": { - expedited: true, + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, }, } for _, tc := range testCases { tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.expedited) + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.proposalType) suite.Require().NoError(err) proposalID := proposal.Id err = suite.govKeeper.SetProposal(suite.ctx, proposal) @@ -45,11 +48,14 @@ func (suite *KeeperTestSuite) TestGetSetProposal() { // TODO(tip): remove this func (suite *KeeperTestSuite) TestDeleteProposal() { testCases := map[string]struct { - expedited bool + proposalType v1.ProposalType }{ - "regular proposal": {}, + "unspecified proposal type": {}, + "regular proposal": { + proposalType: v1.ProposalType_PROPOSAL_TYPE_STANDARD, + }, "expedited proposal": { - expedited: true, + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, }, } @@ -58,7 +64,7 @@ func (suite *KeeperTestSuite) TestDeleteProposal() { suite.Require().ErrorIs(suite.govKeeper.DeleteProposal(suite.ctx, 10), collections.ErrNotFound) tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.expedited) + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.proposalType) suite.Require().NoError(err) proposalID := proposal.Id err = suite.govKeeper.SetProposal(suite.ctx, proposal) @@ -73,16 +79,17 @@ func (suite *KeeperTestSuite) TestDeleteProposal() { func (suite *KeeperTestSuite) TestActivateVotingPeriod() { testCases := []struct { - name string - expedited bool + name string + proposalType v1.ProposalType }{ - {name: "regular proposal"}, - {name: "expedited proposal", expedited: true}, + {name: "unspecified proposal type"}, + {name: "regular proposal", proposalType: v1.ProposalType_PROPOSAL_TYPE_STANDARD}, + {name: "expedited proposal", proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED}, } for _, tc := range testCases { tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.expedited) + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.proposalType) suite.Require().NoError(err) suite.Require().Nil(proposal.VotingStartTime) @@ -103,17 +110,18 @@ func (suite *KeeperTestSuite) TestActivateVotingPeriod() { func (suite *KeeperTestSuite) TestDeleteProposalInVotingPeriod() { testCases := []struct { - name string - expedited bool + name string + proposalType v1.ProposalType }{ - {name: "regular proposal"}, - {name: "expedited proposal", expedited: true}, + {name: "unspecified proposal type"}, + {name: "regular proposal", proposalType: v1.ProposalType_PROPOSAL_TYPE_STANDARD}, + {name: "expedited proposal", proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED}, } for _, tc := range testCases { suite.reset() tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.expedited) + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", suite.addrs[0], tc.proposalType) suite.Require().NoError(err) suite.Require().Nil(proposal.VotingStartTime) @@ -150,31 +158,31 @@ func (suite *KeeperTestSuite) TestSubmitProposal() { tp := v1beta1.TextProposal{Title: "title", Description: "description"} testCases := []struct { - content v1beta1.Content - authority string - metadata string - expedited bool - expectedErr error + content v1beta1.Content + authority string + metadata string + proposalType v1.ProposalType + expectedErr error }{ - {&tp, govAcct, "", false, nil}, - {&tp, govAcct, "", true, nil}, + {&tp, govAcct, "", v1.ProposalType_PROPOSAL_TYPE_STANDARD, nil}, + {&tp, govAcct, "", v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, nil}, // Keeper does not check the validity of title and description, no error - {&v1beta1.TextProposal{Title: "", Description: "description"}, govAcct, "", false, nil}, - {&v1beta1.TextProposal{Title: strings.Repeat("1234567890", 100), Description: "description"}, govAcct, "", false, nil}, - {&v1beta1.TextProposal{Title: "title", Description: ""}, govAcct, "", false, nil}, - {&v1beta1.TextProposal{Title: "title", Description: strings.Repeat("1234567890", 1000)}, govAcct, "", true, nil}, + {&v1beta1.TextProposal{Title: "", Description: "description"}, govAcct, "", v1.ProposalType_PROPOSAL_TYPE_STANDARD, nil}, + {&v1beta1.TextProposal{Title: strings.Repeat("1234567890", 100), Description: "description"}, govAcct, "", v1.ProposalType_PROPOSAL_TYPE_STANDARD, nil}, + {&v1beta1.TextProposal{Title: "title", Description: ""}, govAcct, "", v1.ProposalType_PROPOSAL_TYPE_STANDARD, nil}, + {&v1beta1.TextProposal{Title: "title", Description: strings.Repeat("1234567890", 1000)}, govAcct, "", v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, nil}, // error when metadata is too long (>10000) - {&tp, govAcct, strings.Repeat("a", 100001), true, types.ErrMetadataTooLong}, + {&tp, govAcct, strings.Repeat("a", 100001), v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, types.ErrMetadataTooLong}, // error when signer is not gov acct - {&tp, randomAddr.String(), "", false, types.ErrInvalidSigner}, + {&tp, randomAddr.String(), "", v1.ProposalType_PROPOSAL_TYPE_STANDARD, types.ErrInvalidSigner}, // error only when invalid route - {&invalidProposalRoute{}, govAcct, "", false, types.ErrNoProposalHandlerExists}, + {&invalidProposalRoute{}, govAcct, "", v1.ProposalType_PROPOSAL_TYPE_STANDARD, types.ErrNoProposalHandlerExists}, } for i, tc := range testCases { prop, err := v1.NewLegacyContent(tc.content, tc.authority) suite.Require().NoError(err) - _, err = suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, tc.metadata, "title", "", suite.addrs[0], tc.expedited) + _, err = suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, tc.metadata, "title", "", suite.addrs[0], tc.proposalType) suite.Require().True(errors.Is(tc.expectedErr, err), "tc #%d; got: %v, expected: %v", i, err, tc.expectedErr) } } @@ -184,16 +192,16 @@ func (suite *KeeperTestSuite) TestCancelProposal() { tp := v1beta1.TextProposal{Title: "title", Description: "description"} prop, err := v1.NewLegacyContent(&tp, govAcct) suite.Require().NoError(err) - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[0], false) + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[0], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) proposalID := proposal.Id - proposal2, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[1], true) + proposal2, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[1], v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) suite.Require().NoError(err) proposal2ID := proposal2.Id // proposal3 is only used to check the votes for proposals which doesn't go through `CancelProposal` are still present in state - proposal3, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[2], false) + proposal3, err := suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, "", "title", "summary", suite.addrs[2], v1.ProposalType_PROPOSAL_TYPE_STANDARD) suite.Require().NoError(err) proposal3ID := proposal3.Id diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index a66528c9b7a3..fc84b7830ed1 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -20,6 +20,7 @@ func (keeper Keeper) Tally(ctx context.Context, proposal v1.Proposal) (passes, b results[v1.OptionAbstain] = math.LegacyZeroDec() results[v1.OptionNo] = math.LegacyZeroDec() results[v1.OptionNoWithVeto] = math.LegacyZeroDec() + results[v1.OptionSpam] = math.LegacyZeroDec() totalVotingPower := math.LegacyZeroDec() currValidators := make(map[string]v1.ValidatorGovInfo) @@ -136,6 +137,11 @@ func (keeper Keeper) Tally(ctx context.Context, proposal v1.Proposal) (passes, b return false, params.BurnVoteQuorum, tallyResults, nil } + // If there are more spam votes than the sum of all other options, proposal fails + if results[v1.OptionSpam].GTE(results[v1.OptionOne].Add(results[v1.OptionTwo].Add(results[v1.OptionThree].Add(results[v1.OptionFour])))) { + return false, true, tallyResults, nil + } + // If no one votes (everyone abstains), proposal fails if totalVotingPower.Sub(results[v1.OptionAbstain]).Equal(math.LegacyZeroDec()) { return false, false, tallyResults, nil diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index a3df191673ce..5db9a2db0fe7 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -34,8 +34,7 @@ func TestTally(t *testing.T) { // handy functions setTotalBonded = func(s suite, n int64) { s.mocks.stakingKeeper.EXPECT().ValidatorAddressCodec().Return(address.NewBech32Codec("cosmosvaloper")).AnyTimes() - s.mocks.stakingKeeper.EXPECT().TotalBondedTokens(gomock.Any()). - Return(sdkmath.NewInt(n), nil) + s.mocks.stakingKeeper.EXPECT().TotalBondedTokens(gomock.Any()).Return(sdkmath.NewInt(n), nil) } delegatorVote = func(s suite, voter sdk.AccAddress, delegations []stakingtypes.Delegation, vote v1.VoteOption) { err := s.keeper.AddVote(s.ctx, s.proposal.Id, voter, v1.NewNonSplitVoteOption(vote), "") @@ -57,7 +56,7 @@ func TestTally(t *testing.T) { ) tests := []struct { name string - expedited bool + proposalType v1.ProposalType setup func(suite) expectedPass bool expectedBurn bool @@ -76,6 +75,7 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, }, { @@ -90,13 +90,14 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, }, { name: "one validator votes: prop fails/burn deposit", setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_THREE) }, expectedPass: false, expectedBurn: true, // burn because quorum not reached @@ -105,13 +106,14 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "1000000", NoWithVetoCount: "0", + SpamCount: "0", }, }, { name: "one account votes without delegation: prop fails/burn deposit", setup: func(s suite) { setTotalBonded(s, 10000000) - delegatorVote(s, s.delAddrs[0], nil, v1.VoteOption_VOTE_OPTION_YES) + delegatorVote(s, s.delAddrs[0], nil, v1.VoteOption_VOTE_OPTION_ONE) }, expectedPass: false, expectedBurn: true, // burn because quorum not reached @@ -120,6 +122,7 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, }, { @@ -131,7 +134,7 @@ func TestTally(t *testing.T) { ValidatorAddress: s.valAddrs[0].String(), Shares: sdkmath.LegacyNewDec(42), }} - delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_YES) + delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_ONE) }, expectedPass: false, expectedBurn: true, // burn because quorum not reached @@ -140,6 +143,7 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, }, { @@ -151,8 +155,8 @@ func TestTally(t *testing.T) { ValidatorAddress: s.valAddrs[0].String(), Shares: sdkmath.LegacyNewDec(42), }} - delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) + delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) }, expectedPass: false, expectedBurn: true, // burn because quorum not reached @@ -161,6 +165,7 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, }, { @@ -172,8 +177,8 @@ func TestTally(t *testing.T) { ValidatorAddress: s.valAddrs[0].String(), Shares: sdkmath.LegacyNewDec(42), }} - delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) + delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_THREE) }, expectedPass: false, expectedBurn: true, // burn because quorum not reached @@ -182,6 +187,7 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "999958", NoWithVetoCount: "0", + SpamCount: "0", }, }, { @@ -205,10 +211,10 @@ func TestTally(t *testing.T) { Shares: sdkmath.LegacyNewDec(21), }, } - delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_ABSTAIN) + delegatorVote(s, s.delAddrs[0], delegations, v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_TWO) }, expectedPass: false, expectedBurn: true, // burn because quorum not reached @@ -217,16 +223,17 @@ func TestTally(t *testing.T) { AbstainCount: "1000000", NoCount: "999979", NoWithVetoCount: "0", + SpamCount: "0", }, }, { name: "quorum reached with only abstain: prop fails", setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ABSTAIN) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ABSTAIN) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_ABSTAIN) - validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_ABSTAIN) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_TWO) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_TWO) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_TWO) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_TWO) }, expectedPass: false, expectedBurn: false, @@ -235,19 +242,20 @@ func TestTally(t *testing.T) { AbstainCount: "4000000", NoCount: "0", NoWithVetoCount: "0", + SpamCount: "0", }, }, { name: "quorum reached with veto>1/3: prop fails/burn deposit", setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_NO_WITH_VETO) - validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_NO_WITH_VETO) - validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_NO_WITH_VETO) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_FOUR) + validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_FOUR) + validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_FOUR) }, expectedPass: false, expectedBurn: true, @@ -256,16 +264,17 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "0", NoWithVetoCount: "3000000", + SpamCount: "0", }, }, { name: "quorum reached with yes<=.5: prop fails", setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_NO) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_THREE) }, expectedPass: false, expectedBurn: false, @@ -274,19 +283,20 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "2000000", NoWithVetoCount: "0", + SpamCount: "0", }, }, { name: "quorum reached with yes>.5: prop succeeds", setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_NO_WITH_VETO) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_FOUR) }, expectedPass: true, expectedBurn: false, @@ -295,18 +305,19 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "2000000", NoWithVetoCount: "1000000", + SpamCount: "0", }, }, { name: "quorum reached thanks to abstain, yes>.5: prop succeeds", setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_ABSTAIN) - validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_ABSTAIN) - validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_ABSTAIN) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_TWO) + validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_TWO) + validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_TWO) }, expectedPass: true, expectedBurn: false, @@ -315,20 +326,21 @@ func TestTally(t *testing.T) { AbstainCount: "3000000", NoCount: "1000000", NoWithVetoCount: "0", + SpamCount: "0", }, }, { - name: "quorum reached with yes<=.667: expedited prop fails", - expedited: true, + name: "quorum reached with yes<=.667: expedited prop fails", + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_NO_WITH_VETO) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_FOUR) }, expectedPass: false, expectedBurn: false, @@ -337,20 +349,21 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "2000000", NoWithVetoCount: "1000000", + SpamCount: "0", }, }, { - name: "quorum reached with yes>.667: expedited prop succeeds", - expedited: true, + name: "quorum reached with yes>.667: expedited prop succeeds", + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, setup: func(s suite) { setTotalBonded(s, 10000000) - validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_YES) - validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_NO) - validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_NO_WITH_VETO) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_ONE) + validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_THREE) + validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_FOUR) }, expectedPass: true, expectedBurn: false, @@ -359,6 +372,30 @@ func TestTally(t *testing.T) { AbstainCount: "0", NoCount: "1000000", NoWithVetoCount: "1000000", + SpamCount: "0", + }, + }, + { + name: "quorum reached with spam > all other votes: prop fails/burn deposit", + setup: func(s suite) { + setTotalBonded(s, 10000000) + validatorVote(s, s.valAddrs[0], v1.VoteOption_VOTE_OPTION_ONE) + // spam votes + validatorVote(s, s.valAddrs[1], v1.VoteOption_VOTE_OPTION_SPAM) + validatorVote(s, s.valAddrs[2], v1.VoteOption_VOTE_OPTION_SPAM) + validatorVote(s, s.valAddrs[3], v1.VoteOption_VOTE_OPTION_SPAM) + validatorVote(s, s.valAddrs[4], v1.VoteOption_VOTE_OPTION_SPAM) + validatorVote(s, s.valAddrs[5], v1.VoteOption_VOTE_OPTION_SPAM) + validatorVote(s, s.valAddrs[6], v1.VoteOption_VOTE_OPTION_SPAM) + }, + expectedPass: false, + expectedBurn: true, + expectedTally: v1.TallyResult{ + YesCount: "1000000", + AbstainCount: "0", + NoCount: "0", + NoWithVetoCount: "0", + SpamCount: "6000000", }, }, } @@ -393,8 +430,9 @@ func TestTally(t *testing.T) { } return nil }) + // Submit and activate a proposal - proposal, err := govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", delAddrs[0], tt.expedited) + proposal, err := govKeeper.SubmitProposal(ctx, TestProposal, "", "title", "summary", delAddrs[0], tt.proposalType) require.NoError(t, err) err = govKeeper.ActivateVotingPeriod(ctx, proposal) require.NoError(t, err) diff --git a/x/gov/keeper/vote_test.go b/x/gov/keeper/vote_test.go index e5fcd96e46bd..3220249e2b39 100644 --- a/x/gov/keeper/vote_test.go +++ b/x/gov/keeper/vote_test.go @@ -21,7 +21,7 @@ func TestVotes(t *testing.T) { authKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) proposalID := proposal.Id metadata := "metadata" diff --git a/x/gov/migrations/v3/convert_test.go b/x/gov/migrations/v3/convert_test.go index 0c899ba088e4..3b44f9724552 100644 --- a/x/gov/migrations/v3/convert_test.go +++ b/x/gov/migrations/v3/convert_test.go @@ -120,6 +120,7 @@ func TestConvertToLegacyTallyResult(t *testing.T) { NoCount: tallyResult.NoCount, AbstainCount: tallyResult.AbstainCount, NoWithVetoCount: tallyResult.NoWithVetoCount, + SpamCount: tallyResult.SpamCount, }, expErr: true, }, @@ -129,6 +130,7 @@ func TestConvertToLegacyTallyResult(t *testing.T) { NoCount: "invalid", AbstainCount: tallyResult.AbstainCount, NoWithVetoCount: tallyResult.NoWithVetoCount, + SpamCount: tallyResult.SpamCount, }, expErr: true, }, @@ -138,6 +140,7 @@ func TestConvertToLegacyTallyResult(t *testing.T) { NoCount: tallyResult.NoCount, AbstainCount: "invalid", NoWithVetoCount: tallyResult.NoWithVetoCount, + SpamCount: tallyResult.SpamCount, }, expErr: true, }, @@ -147,6 +150,7 @@ func TestConvertToLegacyTallyResult(t *testing.T) { NoCount: tallyResult.NoCount, AbstainCount: tallyResult.AbstainCount, NoWithVetoCount: "invalid", + SpamCount: tallyResult.SpamCount, }, expErr: true, }, diff --git a/x/gov/migrations/v6/store.go b/x/gov/migrations/v6/store.go new file mode 100644 index 000000000000..0a4a96f77a22 --- /dev/null +++ b/x/gov/migrations/v6/store.go @@ -0,0 +1,29 @@ +package v6 + +import ( + "cosmossdk.io/collections" + v1 "cosmossdk.io/x/gov/types/v1" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// MigrateStore performs in-place store migrations from v5 (v0.50) to v6 (v0.51). The +// migration includes: +// +// Addition of new field in params to store types of proposals that can be submitted. +func MigrateStore(ctx sdk.Context, proposalCollection collections.Map[uint64, v1.Proposal]) error { + // Migrate proposals + return proposalCollection.Walk(ctx, nil, func(key uint64, proposal v1.Proposal) (bool, error) { + if proposal.Expedited { + proposal.ProposalType = v1.ProposalType_PROPOSAL_TYPE_EXPEDITED + } else { + proposal.ProposalType = v1.ProposalType_PROPOSAL_TYPE_STANDARD + } + + if err := proposalCollection.Set(ctx, key, proposal); err != nil { + return false, err + } + + return false, nil + }) +} diff --git a/x/gov/migrations/v6/store_test.go b/x/gov/migrations/v6/store_test.go new file mode 100644 index 000000000000..0474fe332d0c --- /dev/null +++ b/x/gov/migrations/v6/store_test.go @@ -0,0 +1,3 @@ +package v6_test + +// TODO(@julienrbrt): Add migration tests when feature complete. diff --git a/x/gov/module.go b/x/gov/module.go index 63f870b22d3c..0b6f261afbc9 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -35,7 +35,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) -const ConsensusVersion = 5 +const ConsensusVersion = 6 var ( _ module.AppModuleBasic = AppModuleBasic{} @@ -288,6 +288,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(govtypes.ModuleName, 4, m.Migrate4to5); err != nil { panic(fmt.Sprintf("failed to migrate x/gov from version 4 to 5: %v", err)) } + + if err := cfg.RegisterMigration(govtypes.ModuleName, 5, m.Migrate5to6); err != nil { + panic(fmt.Sprintf("failed to migrate x/gov from version 5 to 6: %v", err)) + } } // InitGenesis performs genesis initialization for the gov module. It returns diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index afd979d64524..26969d3365d3 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -205,7 +205,7 @@ func simulateMsgSubmitProposal( // column 3: 75% vote // column 4: 40% vote // column 5: 15% vote - // column 6: noone votes + // column 6: no one votes // All columns sum to 100 for simplicity, values chosen by @valardragon semi-arbitrarily, // feel free to change. numVotesTransitionMatrix, _ := simulation.CreateTransitionMatrix([][]int{ @@ -237,6 +237,11 @@ func simulateMsgSubmitProposal( return simtypes.NoOpMsg(types.ModuleName, TypeMsgSubmitProposal, "unable to generate deposit"), nil, err } + proposalType := v1.ProposalType_PROPOSAL_TYPE_STANDARD + if expedited { + proposalType = v1.ProposalType_PROPOSAL_TYPE_EXPEDITED + } + msg, err := v1.NewMsgSubmitProposal( proposalMsgs, deposit, @@ -244,7 +249,7 @@ func simulateMsgSubmitProposal( simtypes.RandStringOfLength(r, 100), simtypes.RandStringOfLength(r, 100), simtypes.RandStringOfLength(r, 100), - expedited, + proposalType, ) if err != nil { return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "unable to generate a submit proposal msg"), nil, err @@ -635,7 +640,7 @@ func randomProposalID(r *rand.Rand, k *keeper.Keeper, ctx sdk.Context, status v1 proposalID = uint64(simtypes.RandIntBetween(r, int(initialProposalID), int(proposalID))) default: - // This is called on the first call to this funcion + // This is called on the first call to this function // in order to update the global variable initialProposalID = proposalID } diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index 59109228f62f..f1b92a5cf363 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -215,7 +215,7 @@ func TestSimulateMsgCancelProposal(t *testing.T) { params, _ := suite.GovKeeper.Params.Get(ctx) depositPeriod := params.MaxDepositPeriod - proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "title", "summary", proposer, false) + proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "title", "summary", proposer, v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) err = suite.GovKeeper.SetProposal(ctx, proposal) @@ -258,7 +258,7 @@ func TestSimulateMsgDeposit(t *testing.T) { params, _ := suite.GovKeeper.Params.Get(ctx) depositPeriod := params.MaxDepositPeriod - proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) err = suite.GovKeeper.SetProposal(ctx, proposal) @@ -302,7 +302,7 @@ func TestSimulateMsgVote(t *testing.T) { params, _ := suite.GovKeeper.Params.Get(ctx) depositPeriod := params.MaxDepositPeriod - proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) err = suite.GovKeeper.ActivateVotingPeriod(ctx, proposal) @@ -344,7 +344,7 @@ func TestSimulateMsgVoteWeighted(t *testing.T) { params, _ := suite.GovKeeper.Params.Get(ctx) depositPeriod := params.MaxDepositPeriod - proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "test", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "test", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) err = suite.GovKeeper.ActivateVotingPeriod(ctx, proposal) diff --git a/x/gov/types/config.go b/x/gov/types/config.go index 39a809688c64..919d54e5b9ad 100644 --- a/x/gov/types/config.go +++ b/x/gov/types/config.go @@ -1,6 +1,6 @@ package types -// Config is a config struct used for intialising the gov module to avoid using globals. +// Config is a config struct used for initializing the gov module to avoid using globals. type Config struct { // MaxTitleLen defines the amount of characters that can be used for proposal title MaxTitleLen uint64 diff --git a/x/gov/types/v1/genesis.go b/x/gov/types/v1/genesis.go index ef44bd481627..0065eb9ea965 100644 --- a/x/gov/types/v1/genesis.go +++ b/x/gov/types/v1/genesis.go @@ -2,6 +2,9 @@ package v1 import ( "errors" + "fmt" + + "golang.org/x/sync/errgroup" "github.com/cosmos/cosmos-sdk/codec/types" ) @@ -27,13 +30,79 @@ func (data GenesisState) Empty() bool { return data.StartingProposalId == 0 || data.Params == nil } -// ValidateGenesis checks if parameters are within valid ranges +// ValidateGenesis checks if gov genesis state is valid ranges +// It checks if params are in valid ranges +// It also makes sure that the provided proposal IDs are unique and +// that there are no duplicate deposit or vote records and no vote or deposits for non-existent proposals func ValidateGenesis(data *GenesisState) error { if data.StartingProposalId == 0 { return errors.New("starting proposal id must be greater than 0") } - return data.Params.ValidateBasic() + var errGroup errgroup.Group + + // weed out duplicate proposals + proposalIds := make(map[uint64]struct{}) + for _, p := range data.Proposals { + if _, ok := proposalIds[p.Id]; ok { + return fmt.Errorf("duplicate proposal id: %d", p.Id) + } + + proposalIds[p.Id] = struct{}{} + } + + // weed out duplicate deposits + errGroup.Go(func() error { + type depositKey struct { + ProposalId uint64 + Depositor string + } + depositIds := make(map[depositKey]struct{}) + for _, d := range data.Deposits { + if _, ok := proposalIds[d.ProposalId]; !ok { + return fmt.Errorf("deposit %v has non-existent proposal id: %d", d, d.ProposalId) + } + + dk := depositKey{d.ProposalId, d.Depositor} + if _, ok := depositIds[dk]; ok { + return fmt.Errorf("duplicate deposit: %v", d) + } + + depositIds[dk] = struct{}{} + } + + return nil + }) + + // weed out duplicate votes + errGroup.Go(func() error { + type voteKey struct { + ProposalId uint64 + Voter string + } + voteIds := make(map[voteKey]struct{}) + for _, v := range data.Votes { + if _, ok := proposalIds[v.ProposalId]; !ok { + return fmt.Errorf("vote %v has non-existent proposal id: %d", v, v.ProposalId) + } + + vk := voteKey{v.ProposalId, v.Voter} + if _, ok := voteIds[vk]; ok { + return fmt.Errorf("duplicate vote: %v", v) + } + + voteIds[vk] = struct{}{} + } + + return nil + }) + + // verify params + errGroup.Go(func() error { + return data.Params.ValidateBasic() + }) + + return errGroup.Wait() } var _ types.UnpackInterfacesMessage = GenesisState{} diff --git a/x/gov/types/v1/genesis.pb.go b/x/gov/types/v1/genesis.pb.go index 914dfec140d3..bdb88b12ceb0 100644 --- a/x/gov/types/v1/genesis.pb.go +++ b/x/gov/types/v1/genesis.pb.go @@ -33,15 +33,15 @@ type GenesisState struct { // proposals defines all the proposals present at genesis. Proposals []*Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"` // Deprecated: Prefer to use `params` instead. - // deposit_params defines all the paramaters of related to deposit. + // deposit_params defines all the parameters of related to deposit. DepositParams *DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` // Deprecated: Do not use. // Deprecated: Prefer to use `params` instead. - // voting_params defines all the paramaters of related to voting. + // voting_params defines all the parameters of related to voting. VotingParams *VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` // Deprecated: Do not use. // Deprecated: Prefer to use `params` instead. - // tally_params defines all the paramaters of related to tally. + // tally_params defines all the parameters of related to tally. TallyParams *TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` // Deprecated: Do not use. - // params defines all the paramaters of x/gov module. + // params defines all the parameters of x/gov module. // // Since: cosmos-sdk 0.47 Params *Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params,omitempty"` diff --git a/x/gov/types/v1/genesis_test.go b/x/gov/types/v1/genesis_test.go index 74f8e5eb7fda..9d0e42a23b34 100644 --- a/x/gov/types/v1/genesis_test.go +++ b/x/gov/types/v1/genesis_test.go @@ -25,7 +25,7 @@ func TestValidateGenesis(t *testing.T) { testCases := []struct { name string genesisState func() *v1.GenesisState - expErr bool + expErrMsg string }{ { name: "valid", @@ -38,7 +38,7 @@ func TestValidateGenesis(t *testing.T) { genesisState: func() *v1.GenesisState { return v1.NewGenesisState(0, params) }, - expErr: true, + expErrMsg: "starting proposal id must be greater than 0", }, { name: "invalid min deposit", @@ -49,9 +49,9 @@ func TestValidateGenesis(t *testing.T) { Amount: sdkmath.NewInt(-100), }} - return v1.NewGenesisState(0, params1) + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) }, - expErr: true, + expErrMsg: "invalid minimum deposit", }, { name: "invalid max deposit period", @@ -59,9 +59,9 @@ func TestValidateGenesis(t *testing.T) { params1 := params params1.MaxDepositPeriod = nil - return v1.NewGenesisState(0, params1) + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) }, - expErr: true, + expErrMsg: "maximum deposit period must not be nil", }, { name: "invalid quorum", @@ -69,9 +69,9 @@ func TestValidateGenesis(t *testing.T) { params1 := params params1.Quorum = "2" - return v1.NewGenesisState(0, params1) + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) }, - expErr: true, + expErrMsg: "quorom too large", }, { name: "invalid threshold", @@ -79,9 +79,9 @@ func TestValidateGenesis(t *testing.T) { params1 := params params1.Threshold = "2" - return v1.NewGenesisState(0, params1) + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) }, - expErr: true, + expErrMsg: "vote threshold too large", }, { name: "invalid veto threshold", @@ -89,9 +89,86 @@ func TestValidateGenesis(t *testing.T) { params1 := params params1.VetoThreshold = "2" - return v1.NewGenesisState(0, params1) + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) }, - expErr: true, + expErrMsg: "veto threshold too large", + }, + { + name: "duplicate proposals", + genesisState: func() *v1.GenesisState { + state := v1.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + + return state + }, + expErrMsg: "duplicate proposal id: 1", + }, + { + name: "duplicate votes", + genesisState: func() *v1.GenesisState { + state := v1.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + state.Votes = append(state.Votes, + &v1.Vote{ + ProposalId: 1, + Voter: "voter", + }, + &v1.Vote{ + ProposalId: 1, + Voter: "voter", + }) + + return state + }, + expErrMsg: "duplicate vote", + }, + { + name: "duplicate deposits", + genesisState: func() *v1.GenesisState { + state := v1.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + state.Deposits = append(state.Deposits, + &v1.Deposit{ + ProposalId: 1, + Depositor: "depositor", + }, + &v1.Deposit{ + ProposalId: 1, + Depositor: "depositor", + }) + + return state + }, + expErrMsg: "duplicate deposit: proposal_id:1 depositor:\"depositor\"", + }, + { + name: "non-existent proposal id in votes", + genesisState: func() *v1.GenesisState { + state := v1.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Votes = append(state.Votes, + &v1.Vote{ + ProposalId: 1, + Voter: "voter", + }) + + return state + }, + expErrMsg: "vote proposal_id:1 voter:\"voter\" has non-existent proposal id: 1", + }, + { + name: "non-existent proposal id in deposits", + genesisState: func() *v1.GenesisState { + state := v1.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Deposits = append(state.Deposits, + &v1.Deposit{ + ProposalId: 1, + Depositor: "depositor", + }) + + return state + }, + expErrMsg: "deposit proposal_id:1 depositor:\"depositor\"", }, } @@ -99,8 +176,9 @@ func TestValidateGenesis(t *testing.T) { tc := tc t.Run(tc.name, func(t *testing.T) { err := v1.ValidateGenesis(tc.genesisState()) - if tc.expErr { + if tc.expErrMsg != "" { require.Error(t, err) + require.ErrorContains(t, err, tc.expErrMsg) } else { require.NoError(t, err) } diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 509021687711..90f831dc1831 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -32,36 +32,97 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ProposalType enumerates the valid proposal types. +// All proposal types are v1.Proposal which have different voting periods or tallying logic. +type ProposalType int32 + +const ( + // PROPOSAL_TYPE_UNSPECIFIED defines no proposal type, which fallback to PROPOSAL_TYPE_STANDARD. + ProposalType_PROPOSAL_TYPE_UNSPECIFIED ProposalType = 0 + // PROPOSAL_TYPE_STANDARD defines the type for a standard proposal. + ProposalType_PROPOSAL_TYPE_STANDARD ProposalType = 1 + // PROPOSAL_TYPE_MULTIPLE_CHOICE defines the type for a multiple choice proposal. + ProposalType_PROPOSAL_TYPE_MULTIPLE_CHOICE ProposalType = 2 + // PROPOSAL_TYPE_OPTIMISTIC defines the type for an optimistic proposal. + ProposalType_PROPOSAL_TYPE_OPTIMISTIC ProposalType = 3 + // PROPOSAL_TYPE_EXPEDITED defines the type for an expedited proposal. + ProposalType_PROPOSAL_TYPE_EXPEDITED ProposalType = 4 +) + +var ProposalType_name = map[int32]string{ + 0: "PROPOSAL_TYPE_UNSPECIFIED", + 1: "PROPOSAL_TYPE_STANDARD", + 2: "PROPOSAL_TYPE_MULTIPLE_CHOICE", + 3: "PROPOSAL_TYPE_OPTIMISTIC", + 4: "PROPOSAL_TYPE_EXPEDITED", +} + +var ProposalType_value = map[string]int32{ + "PROPOSAL_TYPE_UNSPECIFIED": 0, + "PROPOSAL_TYPE_STANDARD": 1, + "PROPOSAL_TYPE_MULTIPLE_CHOICE": 2, + "PROPOSAL_TYPE_OPTIMISTIC": 3, + "PROPOSAL_TYPE_EXPEDITED": 4, +} + +func (x ProposalType) String() string { + return proto.EnumName(ProposalType_name, int32(x)) +} + +func (ProposalType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e05cb1c0d030febb, []int{0} +} + // VoteOption enumerates the valid vote options for a given governance proposal. type VoteOption int32 const ( // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 - // VOTE_OPTION_YES defines a yes vote option. + // VOTE_OPTION_ONE defines the first proposal vote option. + VoteOption_VOTE_OPTION_ONE VoteOption = 1 + // VOTE_OPTION_YES defines the yes proposal vote option. VoteOption_VOTE_OPTION_YES VoteOption = 1 - // VOTE_OPTION_ABSTAIN defines an abstain vote option. + // VOTE_OPTION_TWO defines the second proposal vote option. + VoteOption_VOTE_OPTION_TWO VoteOption = 2 + // VOTE_OPTION_ABSTAIN defines the abstain proposal vote option. VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 - // VOTE_OPTION_NO defines a no vote option. + // VOTE_OPTION_THREE defines the third proposal vote option. + VoteOption_VOTE_OPTION_THREE VoteOption = 3 + // VOTE_OPTION_NO defines the no proposal vote option. VoteOption_VOTE_OPTION_NO VoteOption = 3 - // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + // VOTE_OPTION_FOUR defines the fourth proposal vote option. + VoteOption_VOTE_OPTION_FOUR VoteOption = 4 + // VOTE_OPTION_NO_WITH_VETO defines the no with veto proposal vote option. VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 + // VOTE_OPTION_SPAM defines the spam proposal vote option. + VoteOption_VOTE_OPTION_SPAM VoteOption = 5 ) var VoteOption_name = map[int32]string{ 0: "VOTE_OPTION_UNSPECIFIED", - 1: "VOTE_OPTION_YES", - 2: "VOTE_OPTION_ABSTAIN", - 3: "VOTE_OPTION_NO", - 4: "VOTE_OPTION_NO_WITH_VETO", + 1: "VOTE_OPTION_ONE", + // Duplicate value: 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_TWO", + // Duplicate value: 2: "VOTE_OPTION_ABSTAIN", + 3: "VOTE_OPTION_THREE", + // Duplicate value: 3: "VOTE_OPTION_NO", + 4: "VOTE_OPTION_FOUR", + // Duplicate value: 4: "VOTE_OPTION_NO_WITH_VETO", + 5: "VOTE_OPTION_SPAM", } var VoteOption_value = map[string]int32{ "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_ONE": 1, "VOTE_OPTION_YES": 1, + "VOTE_OPTION_TWO": 2, "VOTE_OPTION_ABSTAIN": 2, + "VOTE_OPTION_THREE": 3, "VOTE_OPTION_NO": 3, + "VOTE_OPTION_FOUR": 4, "VOTE_OPTION_NO_WITH_VETO": 4, + "VOTE_OPTION_SPAM": 5, } func (x VoteOption) String() string { @@ -69,7 +130,7 @@ func (x VoteOption) String() string { } func (VoteOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e05cb1c0d030febb, []int{0} + return fileDescriptor_e05cb1c0d030febb, []int{1} } // ProposalStatus enumerates the valid statuses of a proposal. @@ -118,7 +179,7 @@ func (x ProposalStatus) String() string { } func (ProposalStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e05cb1c0d030febb, []int{1} + return fileDescriptor_e05cb1c0d030febb, []int{2} } // WeightedVoteOption defines a unit of vote for vote split. @@ -282,11 +343,16 @@ type Proposal struct { // expedited defines if the proposal is expedited // // Since: cosmos-sdk 0.50 - Expedited bool `protobuf:"varint,14,opt,name=expedited,proto3" json:"expedited,omitempty"` + // Deprecated: Use ProposalType instead. + Expedited bool `protobuf:"varint,14,opt,name=expedited,proto3" json:"expedited,omitempty"` // Deprecated: Do not use. // failed_reason defines the reason why the proposal failed // // Since: cosmos-sdk 0.50 FailedReason string `protobuf:"bytes,15,opt,name=failed_reason,json=failedReason,proto3" json:"failed_reason,omitempty"` + // proposal_type defines the type of the proposal + // + // Since: cosmos-sdk 0.51 + ProposalType ProposalType `protobuf:"varint,16,opt,name=proposal_type,json=proposalType,proto3,enum=cosmos.gov.v1.ProposalType" json:"proposal_type,omitempty"` } func (m *Proposal) Reset() { *m = Proposal{} } @@ -413,6 +479,7 @@ func (m *Proposal) GetProposer() string { return "" } +// Deprecated: Do not use. func (m *Proposal) GetExpedited() bool { if m != nil { return m.Expedited @@ -427,6 +494,13 @@ func (m *Proposal) GetFailedReason() string { return "" } +func (m *Proposal) GetProposalType() ProposalType { + if m != nil { + return m.ProposalType + } + return ProposalType_PROPOSAL_TYPE_UNSPECIFIED +} + // TallyResult defines a standard tally for a governance proposal. type TallyResult struct { // yes_count is the number of yes votes on a proposal. @@ -437,6 +511,8 @@ type TallyResult struct { NoCount string `protobuf:"bytes,3,opt,name=no_count,json=noCount,proto3" json:"no_count,omitempty"` // no_with_veto_count is the number of no with veto votes on a proposal. NoWithVetoCount string `protobuf:"bytes,4,opt,name=no_with_veto_count,json=noWithVetoCount,proto3" json:"no_with_veto_count,omitempty"` + // spam_count is the number of spam votes on a proposal. + SpamCount string `protobuf:"bytes,5,opt,name=spam_count,json=spamCount,proto3" json:"spam_count,omitempty"` } func (m *TallyResult) Reset() { *m = TallyResult{} } @@ -500,6 +576,13 @@ func (m *TallyResult) GetNoWithVetoCount() string { return "" } +func (m *TallyResult) GetSpamCount() string { + if m != nil { + return m.SpamCount + } + return "" +} + // Vote defines a vote on a governance proposal. // A Vote consists of a proposal ID, the voter, and the vote option. type Vote struct { @@ -949,6 +1032,7 @@ func (m *Params) GetMinDepositRatio() string { } func init() { + proto.RegisterEnum("cosmos.gov.v1.ProposalType", ProposalType_name, ProposalType_value) proto.RegisterEnum("cosmos.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("cosmos.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) proto.RegisterType((*WeightedVoteOption)(nil), "cosmos.gov.v1.WeightedVoteOption") @@ -965,96 +1049,106 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/gov.proto", fileDescriptor_e05cb1c0d030febb) } var fileDescriptor_e05cb1c0d030febb = []byte{ - // 1422 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x73, 0xd3, 0x46, - 0x1b, 0x8e, 0x6c, 0xc7, 0x71, 0x5e, 0xff, 0x88, 0xd9, 0x04, 0xa2, 0x04, 0xe2, 0x04, 0x7f, 0x0c, - 0x93, 0x8f, 0x0f, 0xec, 0x2f, 0x50, 0x7a, 0x80, 0xce, 0x74, 0x9c, 0xd8, 0x14, 0x67, 0x20, 0x76, - 0x65, 0x93, 0x40, 0x2f, 0x1a, 0x25, 0x5a, 0x9c, 0x9d, 0x5a, 0x5a, 0x57, 0xbb, 0x0e, 0xf1, 0xbd, - 0x97, 0x9e, 0xca, 0xb1, 0xa7, 0x4e, 0x8f, 0x3d, 0xf6, 0xc0, 0xf4, 0x6f, 0xe0, 0xd4, 0x61, 0xb8, - 0xb4, 0x97, 0xd2, 0x0e, 0x1c, 0x3a, 0xc3, 0x5f, 0xd1, 0xd1, 0xee, 0xca, 0x52, 0x1c, 0xb7, 0x49, - 0xb8, 0x24, 0xd2, 0xfb, 0x3e, 0xcf, 0xb3, 0xef, 0xbe, 0x3f, 0x76, 0x65, 0x98, 0xdf, 0xa3, 0xcc, - 0xa1, 0xac, 0xdc, 0xa1, 0x07, 0xe5, 0x83, 0x35, 0xff, 0x5f, 0xa9, 0xe7, 0x51, 0x4e, 0x51, 0x56, - 0x3a, 0x4a, 0xbe, 0xe5, 0x60, 0x6d, 0xb1, 0xa0, 0x70, 0xbb, 0x16, 0xc3, 0xe5, 0x83, 0xb5, 0x5d, - 0xcc, 0xad, 0xb5, 0xf2, 0x1e, 0x25, 0xae, 0x84, 0x2f, 0xce, 0x75, 0x68, 0x87, 0x8a, 0xc7, 0xb2, - 0xff, 0xa4, 0xac, 0xcb, 0x1d, 0x4a, 0x3b, 0x5d, 0x5c, 0x16, 0x6f, 0xbb, 0xfd, 0xa7, 0x65, 0x4e, - 0x1c, 0xcc, 0xb8, 0xe5, 0xf4, 0x14, 0x60, 0x61, 0x14, 0x60, 0xb9, 0x03, 0xe5, 0x2a, 0x8c, 0xba, - 0xec, 0xbe, 0x67, 0x71, 0x42, 0x83, 0x15, 0x17, 0x64, 0x44, 0xa6, 0x5c, 0x54, 0x45, 0x2b, 0x5d, - 0xe7, 0x2c, 0x87, 0xb8, 0xb4, 0x2c, 0xfe, 0x4a, 0x53, 0x91, 0x02, 0xda, 0xc1, 0xa4, 0xb3, 0xcf, - 0xb1, 0xbd, 0x4d, 0x39, 0x6e, 0xf4, 0x7c, 0x25, 0xb4, 0x06, 0x49, 0x2a, 0x9e, 0x74, 0x6d, 0x45, - 0x5b, 0xcd, 0xdd, 0x5c, 0x28, 0x1d, 0xd9, 0x75, 0x29, 0x84, 0x1a, 0x0a, 0x88, 0xae, 0x42, 0xf2, - 0x99, 0x10, 0xd2, 0x63, 0x2b, 0xda, 0xea, 0xf4, 0x7a, 0xee, 0xf5, 0x8b, 0x1b, 0xa0, 0x58, 0x55, - 0xbc, 0x67, 0x28, 0x6f, 0xf1, 0x07, 0x0d, 0xa6, 0xaa, 0xb8, 0x47, 0x19, 0xe1, 0x68, 0x19, 0xd2, - 0x3d, 0x8f, 0xf6, 0x28, 0xb3, 0xba, 0x26, 0xb1, 0xc5, 0x5a, 0x09, 0x03, 0x02, 0x53, 0xdd, 0x46, - 0x1f, 0xc3, 0xb4, 0x2d, 0xb1, 0xd4, 0x53, 0xba, 0xfa, 0xeb, 0x17, 0x37, 0xe6, 0x94, 0x6e, 0xc5, - 0xb6, 0x3d, 0xcc, 0x58, 0x8b, 0x7b, 0xc4, 0xed, 0x18, 0x21, 0x14, 0x7d, 0x02, 0x49, 0xcb, 0xa1, - 0x7d, 0x97, 0xeb, 0xf1, 0x95, 0xf8, 0x6a, 0x3a, 0x8c, 0xdf, 0x2f, 0x53, 0x49, 0x95, 0xa9, 0xb4, - 0x41, 0x89, 0xbb, 0x3e, 0xfd, 0xf2, 0xcd, 0xf2, 0xc4, 0x8f, 0x7f, 0xfd, 0x74, 0x4d, 0x33, 0x14, - 0xa7, 0xf8, 0x75, 0x12, 0x52, 0x4d, 0x15, 0x04, 0xca, 0x41, 0x6c, 0x18, 0x5a, 0x8c, 0xd8, 0xe8, - 0xff, 0x90, 0x72, 0x30, 0x63, 0x56, 0x07, 0x33, 0x3d, 0x26, 0xc4, 0xe7, 0x4a, 0xb2, 0x22, 0xa5, - 0xa0, 0x22, 0xa5, 0x8a, 0x3b, 0x30, 0x86, 0x28, 0x74, 0x1b, 0x92, 0x8c, 0x5b, 0xbc, 0xcf, 0xf4, - 0xb8, 0x48, 0xe6, 0xd2, 0x48, 0x32, 0x83, 0xa5, 0x5a, 0x02, 0x64, 0x28, 0x30, 0xba, 0x0f, 0xe8, - 0x29, 0x71, 0xad, 0xae, 0xc9, 0xad, 0x6e, 0x77, 0x60, 0x7a, 0x98, 0xf5, 0xbb, 0x5c, 0x4f, 0xac, - 0x68, 0xab, 0xe9, 0x9b, 0x8b, 0x23, 0x12, 0x6d, 0x1f, 0x62, 0x08, 0x84, 0x91, 0x17, 0xac, 0x88, - 0x05, 0x55, 0x20, 0xcd, 0xfa, 0xbb, 0x0e, 0xe1, 0xa6, 0xdf, 0x66, 0xfa, 0xa4, 0x92, 0x18, 0x8d, - 0xba, 0x1d, 0xf4, 0xe0, 0x7a, 0xe2, 0xf9, 0x1f, 0xcb, 0x9a, 0x01, 0x92, 0xe4, 0x9b, 0xd1, 0x26, - 0xe4, 0x55, 0x76, 0x4d, 0xec, 0xda, 0x52, 0x27, 0x79, 0x4a, 0x9d, 0x9c, 0x62, 0xd6, 0x5c, 0x5b, - 0x68, 0xd5, 0x21, 0xcb, 0x29, 0xb7, 0xba, 0xa6, 0xb2, 0xeb, 0x53, 0x67, 0xa8, 0x51, 0x46, 0x50, - 0x83, 0x06, 0x7a, 0x00, 0xe7, 0x0e, 0x28, 0x27, 0x6e, 0xc7, 0x64, 0xdc, 0xf2, 0xd4, 0xfe, 0x52, - 0xa7, 0x8c, 0x6b, 0x46, 0x52, 0x5b, 0x3e, 0x53, 0x04, 0x76, 0x1f, 0x94, 0x29, 0xdc, 0xe3, 0xf4, - 0x29, 0xb5, 0xb2, 0x92, 0x18, 0x6c, 0x71, 0xd1, 0x6f, 0x12, 0x6e, 0xd9, 0x16, 0xb7, 0x74, 0xf0, - 0xdb, 0xd6, 0x18, 0xbe, 0xa3, 0x39, 0x98, 0xe4, 0x84, 0x77, 0xb1, 0x9e, 0x16, 0x0e, 0xf9, 0x82, - 0x74, 0x98, 0x62, 0x7d, 0xc7, 0xb1, 0xbc, 0x81, 0x9e, 0x11, 0xf6, 0xe0, 0x15, 0x7d, 0x04, 0x29, - 0x39, 0x11, 0xd8, 0xd3, 0xb3, 0x27, 0x8c, 0xc0, 0x10, 0x89, 0x2e, 0xc1, 0x34, 0x3e, 0xec, 0x61, - 0x9b, 0x70, 0x6c, 0xeb, 0xb9, 0x15, 0x6d, 0x35, 0x65, 0x84, 0x06, 0xf4, 0x1f, 0xc8, 0x3e, 0xb5, - 0x48, 0x17, 0xdb, 0xa6, 0x87, 0x2d, 0x46, 0x5d, 0x7d, 0x46, 0xac, 0x99, 0x91, 0x46, 0x43, 0xd8, - 0x8a, 0xbf, 0x6a, 0x90, 0x8e, 0xb6, 0xd1, 0xff, 0x60, 0x7a, 0x80, 0x99, 0xb9, 0x27, 0xe6, 0x4a, - 0x3b, 0x36, 0xe4, 0x75, 0x97, 0x1b, 0xa9, 0x01, 0x66, 0x1b, 0xbe, 0x1f, 0xdd, 0x82, 0xac, 0xb5, - 0xcb, 0xb8, 0x45, 0x5c, 0x45, 0x88, 0x8d, 0x25, 0x64, 0x14, 0x48, 0x92, 0xfe, 0x0b, 0x29, 0x97, - 0x2a, 0x7c, 0x7c, 0x2c, 0x7e, 0xca, 0xa5, 0x12, 0x7a, 0x17, 0x90, 0x4b, 0xcd, 0x67, 0x84, 0xef, - 0x9b, 0x07, 0x98, 0x07, 0xa4, 0xc4, 0x58, 0xd2, 0x8c, 0x4b, 0x77, 0x08, 0xdf, 0xdf, 0xc6, 0x5c, - 0x92, 0x8b, 0x3f, 0x6b, 0x90, 0xf0, 0x8f, 0xb0, 0x93, 0x0f, 0xa0, 0x12, 0x4c, 0x1e, 0x50, 0x8e, - 0x4f, 0x3e, 0x7c, 0x24, 0x0c, 0xdd, 0x85, 0x29, 0x79, 0x1e, 0x32, 0x3d, 0x21, 0xba, 0xfa, 0xf2, - 0xc8, 0xa4, 0x1e, 0x3f, 0x6c, 0x8d, 0x80, 0x71, 0xa4, 0x6b, 0x26, 0x8f, 0x76, 0xcd, 0x66, 0x22, - 0x15, 0xcf, 0x27, 0x8a, 0xbf, 0x6b, 0x90, 0x55, 0xbd, 0xdf, 0xb4, 0x3c, 0xcb, 0x61, 0xe8, 0x09, - 0xa4, 0x1d, 0xe2, 0x0e, 0x47, 0x49, 0x3b, 0x69, 0x94, 0x96, 0xfc, 0x51, 0x7a, 0xff, 0x66, 0xf9, - 0x7c, 0x84, 0x75, 0x9d, 0x3a, 0x84, 0x63, 0xa7, 0xc7, 0x07, 0x06, 0x38, 0xc4, 0x0d, 0x86, 0xcb, - 0x01, 0xe4, 0x58, 0x87, 0x01, 0xc8, 0xec, 0x61, 0x8f, 0x50, 0x5b, 0x24, 0xc2, 0x5f, 0x61, 0x74, - 0x22, 0xaa, 0xea, 0x16, 0x5a, 0xbf, 0xf2, 0xfe, 0xcd, 0xf2, 0xa5, 0xe3, 0xc4, 0x70, 0x91, 0xef, - 0xfc, 0x81, 0xc9, 0x3b, 0xd6, 0x61, 0xb0, 0x13, 0xe1, 0xbf, 0x13, 0xd3, 0xb5, 0xe2, 0x63, 0xc8, - 0x6c, 0x8b, 0x41, 0x52, 0xbb, 0xab, 0x82, 0x1a, 0xac, 0x60, 0x75, 0xed, 0xa4, 0xd5, 0x13, 0x42, - 0x3d, 0x23, 0x59, 0x11, 0xe5, 0xef, 0x83, 0x66, 0x56, 0xca, 0x57, 0x21, 0xf9, 0x55, 0x9f, 0x7a, - 0x7d, 0x67, 0x4c, 0x27, 0x8b, 0xeb, 0x4a, 0x7a, 0xd1, 0x75, 0x98, 0xe6, 0xfb, 0x1e, 0x66, 0xfb, - 0xb4, 0x6b, 0xff, 0xc3, 0xcd, 0x16, 0x02, 0xd0, 0x6d, 0xc8, 0x89, 0x6e, 0x0c, 0x29, 0xf1, 0xb1, - 0x94, 0xac, 0x8f, 0x6a, 0x07, 0x20, 0x11, 0xe0, 0xb7, 0x29, 0x48, 0xaa, 0xd8, 0x6a, 0x67, 0xac, - 0x69, 0xe4, 0x78, 0x8c, 0xd6, 0xef, 0xe1, 0x87, 0xd5, 0x2f, 0x31, 0xbe, 0x3e, 0xc7, 0x6b, 0x11, - 0xff, 0x80, 0x5a, 0x44, 0xf2, 0x9e, 0x38, 0x7d, 0xde, 0x27, 0xcf, 0x9e, 0xf7, 0xe4, 0x29, 0xf2, - 0x8e, 0xea, 0xb0, 0xe0, 0x27, 0x9a, 0xb8, 0x84, 0x93, 0xf0, 0x3e, 0x32, 0x45, 0xf8, 0xfa, 0xd4, - 0x58, 0x85, 0x0b, 0x0e, 0x71, 0xeb, 0x12, 0xaf, 0xd2, 0x63, 0xf8, 0x68, 0xb4, 0x0e, 0xe7, 0x87, - 0x27, 0xc9, 0x9e, 0xe5, 0xee, 0xe1, 0xae, 0x92, 0x49, 0x8d, 0x95, 0x99, 0x0d, 0xc0, 0x1b, 0x02, - 0x2b, 0x35, 0x36, 0x61, 0x6e, 0x54, 0xc3, 0xc6, 0x8c, 0x8b, 0x4b, 0xe8, 0xdf, 0xce, 0x1e, 0x74, - 0x54, 0xac, 0x8a, 0x19, 0x47, 0x3b, 0x30, 0x3f, 0x3c, 0xee, 0xcd, 0xa3, 0x75, 0x83, 0xd3, 0xd5, - 0xed, 0xfc, 0x90, 0xbf, 0x1d, 0x2d, 0xe0, 0xa7, 0x30, 0x1b, 0x0a, 0x87, 0xf9, 0x4e, 0x8f, 0xdd, - 0x26, 0x1a, 0x42, 0xc3, 0xa4, 0x3f, 0x86, 0x50, 0xd9, 0x8c, 0xf6, 0x79, 0xe6, 0x0c, 0x7d, 0x1e, - 0xc6, 0xf0, 0x30, 0x6c, 0xf8, 0x55, 0xc8, 0xef, 0xf6, 0x3d, 0xd7, 0xdf, 0x2e, 0x36, 0x55, 0x97, - 0x65, 0xc5, 0xd5, 0x97, 0xf3, 0xed, 0xfe, 0x91, 0xfb, 0xb9, 0xec, 0xae, 0x0a, 0x2c, 0x09, 0xe4, - 0x30, 0xdd, 0xc3, 0x21, 0xf1, 0xb0, 0xcf, 0x56, 0x37, 0xe6, 0xa2, 0x0f, 0x0a, 0x3e, 0xcf, 0x82, - 0x69, 0x90, 0x08, 0x74, 0x05, 0x72, 0xe1, 0x62, 0x7e, 0x5b, 0x89, 0x3b, 0x34, 0x65, 0x64, 0x82, - 0xa5, 0xfc, 0xeb, 0x06, 0xdd, 0x81, 0x73, 0x91, 0x2d, 0xaa, 0x96, 0xc8, 0x8f, 0xcd, 0xd5, 0x4c, - 0x38, 0xba, 0xa2, 0x1d, 0xae, 0x7d, 0xa3, 0x01, 0x44, 0xbe, 0xc9, 0x2f, 0xc2, 0xfc, 0x76, 0xa3, - 0x5d, 0x33, 0x1b, 0xcd, 0x76, 0xbd, 0xb1, 0x65, 0x3e, 0xda, 0x6a, 0x35, 0x6b, 0x1b, 0xf5, 0x7b, - 0xf5, 0x5a, 0x35, 0x3f, 0x81, 0x66, 0x61, 0x26, 0xea, 0x7c, 0x52, 0x6b, 0xe5, 0x35, 0x34, 0x0f, - 0xb3, 0x51, 0x63, 0x65, 0xbd, 0xd5, 0xae, 0xd4, 0xb7, 0xf2, 0x31, 0x84, 0x20, 0x17, 0x75, 0x6c, - 0x35, 0xf2, 0x71, 0x74, 0x09, 0xf4, 0xa3, 0x36, 0x73, 0xa7, 0xde, 0xbe, 0x6f, 0x6e, 0xd7, 0xda, - 0x8d, 0x7c, 0xe2, 0xda, 0x2f, 0x1a, 0xe4, 0x8e, 0x7e, 0xa7, 0xa2, 0x65, 0xb8, 0xd8, 0x34, 0x1a, - 0xcd, 0x46, 0xab, 0xf2, 0xc0, 0x6c, 0xb5, 0x2b, 0xed, 0x47, 0xad, 0x91, 0x98, 0x8a, 0x50, 0x18, - 0x05, 0x54, 0x6b, 0xcd, 0x46, 0xab, 0xde, 0x36, 0x9b, 0x35, 0xa3, 0xde, 0xa8, 0xe6, 0x35, 0x74, - 0x19, 0x96, 0x46, 0x31, 0xdb, 0x8d, 0x76, 0x7d, 0xeb, 0xb3, 0x00, 0x12, 0x43, 0x8b, 0x70, 0x61, - 0x14, 0xd2, 0xac, 0xb4, 0x5a, 0xb5, 0xaa, 0x0c, 0x7a, 0xd4, 0x67, 0xd4, 0x36, 0x6b, 0x1b, 0xed, - 0x5a, 0x35, 0x9f, 0x18, 0xc7, 0xbc, 0x57, 0xa9, 0x3f, 0xa8, 0x55, 0xf3, 0x93, 0xeb, 0xb7, 0x5f, - 0xbe, 0x2d, 0x68, 0xaf, 0xde, 0x16, 0xb4, 0x3f, 0xdf, 0x16, 0xb4, 0xe7, 0xef, 0x0a, 0x13, 0xaf, - 0xde, 0x15, 0x26, 0x7e, 0x7b, 0x57, 0x98, 0xf8, 0xe2, 0xa2, 0xac, 0x09, 0xb3, 0xbf, 0x2c, 0x11, - 0x5a, 0x3e, 0x14, 0xbf, 0x00, 0xf9, 0xa0, 0x87, 0x99, 0xff, 0xf3, 0x2e, 0x29, 0xa6, 0xe5, 0xd6, - 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xb5, 0x41, 0x36, 0x1f, 0x0e, 0x00, 0x00, + // 1581 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4d, 0x53, 0xe3, 0xc8, + 0x19, 0x46, 0xfe, 0xc2, 0x7e, 0xfd, 0x81, 0x68, 0x60, 0x11, 0xb0, 0x18, 0xd6, 0xd9, 0xda, 0x22, + 0x64, 0xc7, 0x0e, 0xbb, 0x99, 0x1c, 0x76, 0x52, 0x95, 0xf8, 0x43, 0x13, 0x44, 0x01, 0x76, 0x64, + 0x01, 0x33, 0xb9, 0xa8, 0x04, 0xea, 0x31, 0xaa, 0x58, 0x6a, 0x47, 0x6a, 0x33, 0xf8, 0x0f, 0xe4, + 0x9a, 0x39, 0xe6, 0x94, 0xca, 0x2d, 0x39, 0xe6, 0x30, 0x95, 0xdf, 0x30, 0x95, 0x43, 0x6a, 0x6a, + 0x4e, 0xb9, 0x64, 0x92, 0x9a, 0x39, 0xa4, 0x6a, 0x7e, 0x42, 0x4e, 0x29, 0xb5, 0x5a, 0x96, 0x6c, + 0x3c, 0x0b, 0xcc, 0x05, 0xa4, 0xf7, 0x7d, 0x9e, 0xa7, 0xdf, 0x7e, 0x3f, 0xba, 0x2d, 0x58, 0xbd, + 0x20, 0x9e, 0x4d, 0xbc, 0x5a, 0x8f, 0x5c, 0xd5, 0xae, 0xf6, 0xfc, 0x7f, 0xd5, 0x81, 0x4b, 0x28, + 0x41, 0xc5, 0xc0, 0x51, 0xf5, 0x2d, 0x57, 0x7b, 0xeb, 0x65, 0x8e, 0x3b, 0x37, 0x3c, 0x5c, 0xbb, + 0xda, 0x3b, 0xc7, 0xd4, 0xd8, 0xab, 0x5d, 0x10, 0xcb, 0x09, 0xe0, 0xeb, 0xcb, 0x3d, 0xd2, 0x23, + 0xec, 0xb1, 0xe6, 0x3f, 0x71, 0xeb, 0x56, 0x8f, 0x90, 0x5e, 0x1f, 0xd7, 0xd8, 0xdb, 0xf9, 0xf0, + 0x59, 0x8d, 0x5a, 0x36, 0xf6, 0xa8, 0x61, 0x0f, 0x38, 0x60, 0x6d, 0x1a, 0x60, 0x38, 0x23, 0xee, + 0x2a, 0x4f, 0xbb, 0xcc, 0xa1, 0x6b, 0x50, 0x8b, 0x84, 0x2b, 0xae, 0x05, 0x11, 0xe9, 0xc1, 0xa2, + 0x3c, 0xda, 0xc0, 0xb5, 0x68, 0xd8, 0x96, 0x43, 0x6a, 0xec, 0x6f, 0x60, 0xaa, 0x10, 0x40, 0x67, + 0xd8, 0xea, 0x5d, 0x52, 0x6c, 0x9e, 0x12, 0x8a, 0xdb, 0x03, 0x5f, 0x09, 0xed, 0x41, 0x86, 0xb0, + 0x27, 0x49, 0xd8, 0x16, 0x76, 0x4a, 0xdf, 0xac, 0x55, 0x27, 0x76, 0x5d, 0x8d, 0xa0, 0x2a, 0x07, + 0xa2, 0xaf, 0x20, 0xf3, 0x9c, 0x09, 0x49, 0x89, 0x6d, 0x61, 0x27, 0xd7, 0x28, 0xbd, 0x79, 0xf9, + 0x00, 0x38, 0xab, 0x85, 0x2f, 0x54, 0xee, 0xad, 0xfc, 0x49, 0x80, 0xf9, 0x16, 0x1e, 0x10, 0xcf, + 0xa2, 0x68, 0x0b, 0xf2, 0x03, 0x97, 0x0c, 0x88, 0x67, 0xf4, 0x75, 0xcb, 0x64, 0x6b, 0xa5, 0x54, + 0x08, 0x4d, 0x8a, 0x89, 0x7e, 0x0a, 0x39, 0x33, 0xc0, 0x12, 0x97, 0xeb, 0x4a, 0x6f, 0x5e, 0x3e, + 0x58, 0xe6, 0xba, 0x75, 0xd3, 0x74, 0xb1, 0xe7, 0x75, 0xa9, 0x6b, 0x39, 0x3d, 0x35, 0x82, 0xa2, + 0x9f, 0x41, 0xc6, 0xb0, 0xc9, 0xd0, 0xa1, 0x52, 0x72, 0x3b, 0xb9, 0x93, 0x8f, 0xe2, 0xf7, 0xcb, + 0x54, 0xe5, 0x65, 0xaa, 0x36, 0x89, 0xe5, 0x34, 0x72, 0xaf, 0xde, 0x6e, 0xcd, 0xfd, 0xe5, 0xbf, + 0x7f, 0xdd, 0x15, 0x54, 0xce, 0xa9, 0xfc, 0x3d, 0x03, 0xd9, 0x0e, 0x0f, 0x02, 0x95, 0x20, 0x31, + 0x0e, 0x2d, 0x61, 0x99, 0xe8, 0xc7, 0x90, 0xb5, 0xb1, 0xe7, 0x19, 0x3d, 0xec, 0x49, 0x09, 0x26, + 0xbe, 0x5c, 0x0d, 0x2a, 0x52, 0x0d, 0x2b, 0x52, 0xad, 0x3b, 0x23, 0x75, 0x8c, 0x42, 0x0f, 0x21, + 0xe3, 0x51, 0x83, 0x0e, 0x3d, 0x29, 0xc9, 0x92, 0xb9, 0x39, 0x95, 0xcc, 0x70, 0xa9, 0x2e, 0x03, + 0xa9, 0x1c, 0x8c, 0xf6, 0x01, 0x3d, 0xb3, 0x1c, 0xa3, 0xaf, 0x53, 0xa3, 0xdf, 0x1f, 0xe9, 0x2e, + 0xf6, 0x86, 0x7d, 0x2a, 0xa5, 0xb6, 0x85, 0x9d, 0xfc, 0x37, 0xeb, 0x53, 0x12, 0x9a, 0x0f, 0x51, + 0x19, 0x42, 0x15, 0x19, 0x2b, 0x66, 0x41, 0x75, 0xc8, 0x7b, 0xc3, 0x73, 0xdb, 0xa2, 0xba, 0xdf, + 0x66, 0x52, 0x9a, 0x4b, 0x4c, 0x47, 0xad, 0x85, 0x3d, 0xd8, 0x48, 0xbd, 0xf8, 0xf7, 0x96, 0xa0, + 0x42, 0x40, 0xf2, 0xcd, 0xe8, 0x00, 0x44, 0x9e, 0x5d, 0x1d, 0x3b, 0x66, 0xa0, 0x93, 0xb9, 0xa3, + 0x4e, 0x89, 0x33, 0x65, 0xc7, 0x64, 0x5a, 0x0a, 0x14, 0x29, 0xa1, 0x46, 0x5f, 0xe7, 0x76, 0x69, + 0xfe, 0x1e, 0x35, 0x2a, 0x30, 0x6a, 0xd8, 0x40, 0x87, 0xb0, 0x78, 0x45, 0xa8, 0xe5, 0xf4, 0x74, + 0x8f, 0x1a, 0x2e, 0xdf, 0x5f, 0xf6, 0x8e, 0x71, 0x2d, 0x04, 0xd4, 0xae, 0xcf, 0x64, 0x81, 0xed, + 0x03, 0x37, 0x45, 0x7b, 0xcc, 0xdd, 0x51, 0xab, 0x18, 0x10, 0xc3, 0x2d, 0xae, 0xfb, 0x4d, 0x42, + 0x0d, 0xd3, 0xa0, 0x86, 0x04, 0x7e, 0xdb, 0xaa, 0xe3, 0x77, 0xb4, 0x0c, 0x69, 0x6a, 0xd1, 0x3e, + 0x96, 0xf2, 0xcc, 0x11, 0xbc, 0x20, 0x09, 0xe6, 0xbd, 0xa1, 0x6d, 0x1b, 0xee, 0x48, 0x2a, 0x30, + 0x7b, 0xf8, 0x8a, 0x7e, 0x02, 0xd9, 0x60, 0x22, 0xb0, 0x2b, 0x15, 0x6f, 0x19, 0x81, 0x31, 0x12, + 0x6d, 0x43, 0x0e, 0x5f, 0x0f, 0xb0, 0x69, 0x51, 0x6c, 0x4a, 0xa5, 0x6d, 0x61, 0x27, 0xdb, 0x48, + 0x48, 0x82, 0x1a, 0x19, 0xd1, 0x0f, 0xa0, 0xf8, 0xcc, 0xb0, 0xfa, 0xd8, 0xd4, 0x5d, 0x6c, 0x78, + 0xc4, 0x91, 0x16, 0xd8, 0xba, 0x85, 0xc0, 0xa8, 0x32, 0x1b, 0xfa, 0x05, 0x14, 0xc7, 0x13, 0x4a, + 0x47, 0x03, 0x2c, 0x89, 0xac, 0x85, 0x37, 0x3e, 0xd2, 0xc2, 0xda, 0x68, 0x80, 0xd5, 0xc2, 0x20, + 0xf6, 0x56, 0xf9, 0x5d, 0x02, 0xf2, 0xf1, 0x66, 0xfc, 0x11, 0xe4, 0x46, 0xd8, 0xd3, 0x2f, 0xd8, + 0x74, 0x0a, 0x37, 0x8e, 0x0a, 0xc5, 0xa1, 0x6a, 0x76, 0x84, 0xbd, 0xa6, 0xef, 0x47, 0xdf, 0x42, + 0xd1, 0x38, 0xf7, 0xa8, 0x61, 0x39, 0x9c, 0x90, 0x98, 0x49, 0x28, 0x70, 0x50, 0x40, 0xfa, 0x21, + 0x64, 0x1d, 0xc2, 0xf1, 0xc9, 0x99, 0xf8, 0x79, 0x87, 0x04, 0xd0, 0x47, 0x80, 0x1c, 0xa2, 0x3f, + 0xb7, 0xe8, 0xa5, 0x7e, 0x85, 0x69, 0x48, 0x4a, 0xcd, 0x24, 0x2d, 0x38, 0xe4, 0xcc, 0xa2, 0x97, + 0xa7, 0x98, 0x72, 0xf2, 0x03, 0x00, 0x6f, 0x60, 0xd8, 0x9c, 0x94, 0x9e, 0x49, 0xca, 0xf9, 0x08, + 0x06, 0xaf, 0xfc, 0x4d, 0x80, 0x94, 0x7f, 0x6e, 0xde, 0x7e, 0xea, 0x55, 0x21, 0x7d, 0x45, 0x28, + 0xbe, 0xfd, 0xc4, 0x0b, 0x60, 0xe8, 0x11, 0xcc, 0x07, 0x87, 0xb0, 0x27, 0xa5, 0xd8, 0x28, 0x7d, + 0x31, 0x55, 0x9e, 0x9b, 0x27, 0xbc, 0x1a, 0x32, 0x26, 0x5a, 0x35, 0x3d, 0xd9, 0xaa, 0x07, 0xa9, + 0x6c, 0x52, 0x4c, 0x55, 0xfe, 0x25, 0x40, 0x91, 0x0f, 0x5c, 0xc7, 0x70, 0x0d, 0xdb, 0x43, 0x4f, + 0x21, 0x6f, 0x5b, 0xce, 0x78, 0x7e, 0x85, 0xdb, 0xe6, 0x77, 0xd3, 0x9f, 0xdf, 0x0f, 0x6f, 0xb7, + 0x56, 0x62, 0xac, 0xaf, 0x89, 0x6d, 0x51, 0x6c, 0x0f, 0xe8, 0x48, 0x05, 0xdb, 0x72, 0xc2, 0x89, + 0xb6, 0x01, 0xd9, 0xc6, 0x75, 0x08, 0xd2, 0x07, 0xd8, 0xb5, 0x88, 0xc9, 0x12, 0xe1, 0xaf, 0x30, + 0x3d, 0x86, 0x2d, 0x7e, 0xf5, 0x35, 0xbe, 0xfc, 0xf0, 0x76, 0xeb, 0xf3, 0x9b, 0xc4, 0x68, 0x91, + 0x3f, 0xf8, 0x53, 0x2a, 0xda, 0xc6, 0x75, 0xb8, 0x13, 0xe6, 0xff, 0x2e, 0x21, 0x09, 0x95, 0x27, + 0x50, 0x38, 0x65, 0xd3, 0xcb, 0x77, 0xd7, 0x02, 0x3e, 0xcd, 0xe1, 0xea, 0xc2, 0x6d, 0xab, 0xa7, + 0x98, 0x7a, 0x21, 0x60, 0xc5, 0x94, 0xff, 0x28, 0xf0, 0xde, 0xe7, 0xca, 0x5f, 0x41, 0xe6, 0xb7, + 0x43, 0xe2, 0x0e, 0xed, 0x19, 0x8d, 0xcf, 0xee, 0xc8, 0xc0, 0x8b, 0xbe, 0x86, 0x1c, 0xbd, 0x74, + 0xb1, 0x77, 0x49, 0xfa, 0xe6, 0x47, 0xae, 0xd3, 0x08, 0x80, 0x1e, 0x42, 0x89, 0x35, 0x6f, 0x44, + 0x49, 0xce, 0xa4, 0x14, 0x7d, 0x94, 0x16, 0x82, 0x58, 0x80, 0xbf, 0xcf, 0x42, 0x86, 0xc7, 0x26, + 0xdf, 0xb3, 0xa6, 0xb1, 0x33, 0x39, 0x5e, 0xbf, 0xa3, 0x4f, 0xab, 0x5f, 0x6a, 0x76, 0x7d, 0x6e, + 0xd6, 0x22, 0xf9, 0x09, 0xb5, 0x88, 0xe5, 0x3d, 0x75, 0xf7, 0xbc, 0xa7, 0xef, 0x9f, 0xf7, 0xcc, + 0x1d, 0xf2, 0x8e, 0x14, 0x58, 0xf3, 0x13, 0x6d, 0x39, 0x16, 0xb5, 0xa2, 0x4b, 0x50, 0x67, 0xe1, + 0x4b, 0xf3, 0x33, 0x15, 0x3e, 0xb3, 0x2d, 0x47, 0x09, 0xf0, 0x3c, 0x3d, 0xaa, 0x8f, 0x46, 0x0d, + 0x58, 0x19, 0x9f, 0x24, 0x17, 0x86, 0x73, 0x81, 0xfb, 0x5c, 0x26, 0x3b, 0x53, 0x66, 0x29, 0x04, + 0x37, 0x19, 0x36, 0xd0, 0x38, 0x80, 0xe5, 0x69, 0x0d, 0x13, 0x7b, 0x94, 0xdd, 0x7c, 0xdf, 0x77, + 0xf6, 0xa0, 0x49, 0xb1, 0x16, 0xf6, 0x28, 0x3a, 0x83, 0xd5, 0xf1, 0xfd, 0xa2, 0x4f, 0xd6, 0x0d, + 0xee, 0x56, 0xb7, 0x95, 0x31, 0xff, 0x34, 0x5e, 0xc0, 0x9f, 0xc3, 0x52, 0x24, 0x1c, 0xe5, 0x3b, + 0x3f, 0x73, 0x9b, 0x68, 0x0c, 0x8d, 0x92, 0xfe, 0x04, 0x22, 0x65, 0x3d, 0xde, 0xe7, 0x85, 0x7b, + 0xf4, 0x79, 0x14, 0xc3, 0x51, 0xd4, 0xf0, 0x3b, 0x20, 0x9e, 0x0f, 0x5d, 0xc7, 0xdf, 0x2e, 0xd6, + 0x79, 0x97, 0xf9, 0xd7, 0x74, 0x56, 0x2d, 0xf9, 0x76, 0xff, 0xc8, 0xfd, 0x55, 0xd0, 0x5d, 0x75, + 0xd8, 0x64, 0xc8, 0x71, 0xba, 0xc7, 0x43, 0xe2, 0x62, 0x9f, 0x1d, 0x5c, 0xd3, 0xea, 0xba, 0x0f, + 0x0a, 0x2f, 0xd4, 0x70, 0x1a, 0x02, 0x04, 0xfa, 0x12, 0x4a, 0xd1, 0x62, 0x7e, 0x5b, 0xb1, 0x4b, + 0x3b, 0xab, 0x16, 0xc2, 0xa5, 0xfc, 0xdb, 0x09, 0x7d, 0x07, 0x8b, 0xb1, 0x2d, 0xf2, 0x96, 0x10, + 0x67, 0xe6, 0x6a, 0x21, 0x1a, 0x5d, 0xd6, 0x0e, 0xbb, 0x7f, 0x16, 0xa0, 0x10, 0xbf, 0xcd, 0xd1, + 0x26, 0xac, 0x75, 0xd4, 0x76, 0xa7, 0xdd, 0xad, 0x1f, 0xea, 0xda, 0xd3, 0x8e, 0xac, 0x9f, 0x1c, + 0x77, 0x3b, 0x72, 0x53, 0x79, 0xac, 0xc8, 0x2d, 0x71, 0x0e, 0xad, 0xc3, 0x67, 0x93, 0xee, 0xae, + 0x56, 0x3f, 0x6e, 0xd5, 0xd5, 0x96, 0x28, 0xa0, 0x2f, 0x60, 0x73, 0xd2, 0x77, 0x74, 0x72, 0xa8, + 0x29, 0x9d, 0x43, 0x59, 0x6f, 0xee, 0xb7, 0x95, 0xa6, 0x2c, 0x26, 0xd0, 0xe7, 0x20, 0x4d, 0x42, + 0xda, 0x1d, 0x4d, 0x39, 0x52, 0xba, 0x9a, 0xd2, 0x14, 0x93, 0x68, 0x03, 0x56, 0x27, 0xbd, 0xf2, + 0x93, 0x8e, 0xdc, 0x52, 0x34, 0xb9, 0x25, 0xa6, 0x76, 0xff, 0x27, 0x00, 0xc4, 0x3e, 0x59, 0x36, + 0x60, 0xf5, 0xb4, 0xad, 0x05, 0x02, 0xed, 0xe3, 0xa9, 0x28, 0x97, 0x60, 0x21, 0xee, 0x6c, 0x1f, + 0xcb, 0xa2, 0x30, 0x6d, 0x7c, 0x2a, 0x77, 0x6f, 0x1a, 0xb5, 0xb3, 0xb6, 0x98, 0x40, 0xab, 0xb0, + 0x14, 0x37, 0xd6, 0x1b, 0x5d, 0xad, 0xae, 0x1c, 0x8b, 0x09, 0xb4, 0x02, 0x8b, 0x13, 0xe8, 0x7d, + 0x55, 0x96, 0xc5, 0x24, 0x42, 0x50, 0x8a, 0x9b, 0x8f, 0xdb, 0x62, 0x12, 0x2d, 0x83, 0x18, 0xb7, + 0x3d, 0x6e, 0x9f, 0xa8, 0x62, 0xca, 0xdf, 0xff, 0x24, 0x52, 0x3f, 0x53, 0xb4, 0x7d, 0xfd, 0x54, + 0xd6, 0xda, 0x62, 0x6a, 0x9a, 0xd3, 0xed, 0xd4, 0x8f, 0xc4, 0xf4, 0x7a, 0x42, 0x14, 0x76, 0xff, + 0x21, 0x40, 0x69, 0xf2, 0xbb, 0x01, 0x6d, 0xc1, 0xc6, 0x38, 0x59, 0x5d, 0xad, 0xae, 0x9d, 0x74, + 0xa7, 0x92, 0x50, 0x81, 0xf2, 0x34, 0xa0, 0x25, 0x77, 0xda, 0x5d, 0x45, 0xd3, 0x3b, 0xb2, 0xaa, + 0xb4, 0xa7, 0x4b, 0xc6, 0x31, 0xa7, 0x6d, 0x4d, 0x39, 0xfe, 0x65, 0x08, 0x49, 0x4c, 0x54, 0x9c, + 0x43, 0x3a, 0xf5, 0x6e, 0x57, 0x6e, 0x89, 0xc9, 0x89, 0x72, 0x72, 0x9f, 0x2a, 0x1f, 0xc8, 0x4d, + 0x56, 0xb1, 0x59, 0xcc, 0xc7, 0x75, 0xe5, 0x50, 0x6e, 0x89, 0xe9, 0xc6, 0xc3, 0x57, 0xef, 0xca, + 0xc2, 0xeb, 0x77, 0x65, 0xe1, 0x3f, 0xef, 0xca, 0xc2, 0x8b, 0xf7, 0xe5, 0xb9, 0xd7, 0xef, 0xcb, + 0x73, 0xff, 0x7c, 0x5f, 0x9e, 0xfb, 0xf5, 0x46, 0xd0, 0xae, 0x9e, 0xf9, 0x9b, 0xaa, 0x45, 0x6a, + 0xd7, 0xec, 0x8b, 0xdc, 0xff, 0x29, 0xea, 0xf9, 0x9f, 0xdb, 0x19, 0x76, 0x90, 0x7c, 0xfb, 0xff, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x83, 0xbf, 0x15, 0xa8, 0xaf, 0x0f, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1161,6 +1255,13 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ProposalType != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalType)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } if len(m.FailedReason) > 0 { i -= len(m.FailedReason) copy(dAtA[i:], m.FailedReason) @@ -1319,6 +1420,13 @@ func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.SpamCount) > 0 { + i -= len(m.SpamCount) + copy(dAtA[i:], m.SpamCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.SpamCount))) + i-- + dAtA[i] = 0x2a + } if len(m.NoWithVetoCount) > 0 { i -= len(m.NoWithVetoCount) copy(dAtA[i:], m.NoWithVetoCount) @@ -1815,6 +1923,9 @@ func (m *Proposal) Size() (n int) { if l > 0 { n += 1 + l + sovGov(uint64(l)) } + if m.ProposalType != 0 { + n += 2 + sovGov(uint64(m.ProposalType)) + } return n } @@ -1840,6 +1951,10 @@ func (m *TallyResult) Size() (n int) { if l > 0 { n += 1 + l + sovGov(uint64(l)) } + l = len(m.SpamCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } return n } @@ -2733,6 +2848,25 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { } m.FailedReason = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalType", wireType) + } + m.ProposalType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalType |= ProposalType(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) @@ -2911,6 +3045,38 @@ func (m *TallyResult) Unmarshal(dAtA []byte) error { } m.NoWithVetoCount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpamCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpamCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index 812c05250564..847f35f75e3a 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -18,7 +18,7 @@ func NewMsgSubmitProposal( messages []sdk.Msg, initialDeposit sdk.Coins, proposer, metadata, title, summary string, - expedited bool, + proposalType ProposalType, ) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ InitialDeposit: initialDeposit, @@ -26,7 +26,7 @@ func NewMsgSubmitProposal( Metadata: metadata, Title: title, Summary: summary, - Expedited: expedited, + ProposalType: proposalType, } anys, err := sdktx.SetMsgs(messages) diff --git a/x/gov/types/v1/msgs_test.go b/x/gov/types/v1/msgs_test.go index 1078bf524641..29155a123be4 100644 --- a/x/gov/types/v1/msgs_test.go +++ b/x/gov/types/v1/msgs_test.go @@ -21,6 +21,10 @@ var ( sdk.AccAddress("test1"), sdk.AccAddress("test2"), } + addrStrs = []string{ + "cosmos1w3jhxap3gempvr", + "cosmos1w3jhxapjx2whzu", + } ) func init() { @@ -41,34 +45,34 @@ func TestMsgDepositGetSignBytes(t *testing.T) { func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { pc := codec.NewProtoCodec(types.NewInterfaceRegistry()) testcases := []struct { - name string - proposal []sdk.Msg - title string - summary string - expedited bool - expSignBz string + name string + proposal []sdk.Msg + title string + summary string + proposalType v1.ProposalType + expSignBz string }{ { "MsgVote", []sdk.Msg{v1.NewMsgVote(addrs[0], 1, v1.OptionYes, "")}, "gov/MsgVote", "Proposal for a governance vote msg", - false, - `{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/v1/MsgVote","value":{"option":1,"proposal_id":"1","voter":"cosmos1w3jhxap3gempvr"}}],"summary":"Proposal for a governance vote msg","title":"gov/MsgVote"}}`, + v1.ProposalType_PROPOSAL_TYPE_STANDARD, + `{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/v1/MsgVote","value":{"option":1,"proposal_id":"1","voter":"cosmos1w3jhxap3gempvr"}}],"proposal_type":1,"summary":"Proposal for a governance vote msg","title":"gov/MsgVote"}}`, }, { "MsgSend", - []sdk.Msg{banktypes.NewMsgSend(addrs[0], addrs[0], sdk.NewCoins())}, + []sdk.Msg{banktypes.NewMsgSend(addrStrs[0], addrStrs[0], sdk.NewCoins())}, "bank/MsgSend", "Proposal for a bank msg send", - false, - fmt.Sprintf(`{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/MsgSend","value":{"amount":[],"from_address":"%s","to_address":"%s"}}],"summary":"Proposal for a bank msg send","title":"bank/MsgSend"}}`, addrs[0], addrs[0]), + v1.ProposalType_PROPOSAL_TYPE_STANDARD, + fmt.Sprintf(`{"type":"cosmos-sdk/v1/MsgSubmitProposal","value":{"initial_deposit":[],"messages":[{"type":"cosmos-sdk/MsgSend","value":{"amount":[],"from_address":"%s","to_address":"%s"}}],"proposal_type":1,"summary":"Proposal for a bank msg send","title":"bank/MsgSend"}}`, addrStrs[0], addrStrs[0]), }, } for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { - msg, err := v1.NewMsgSubmitProposal(tc.proposal, sdk.NewCoins(), sdk.AccAddress{}.String(), "", tc.title, tc.summary, tc.expedited) + msg, err := v1.NewMsgSubmitProposal(tc.proposal, sdk.NewCoins(), "", "", tc.title, tc.summary, tc.proposalType) require.NoError(t, err) bz, err := pc.MarshalAminoJSON(msg) require.NoError(t, err) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 658104a954bf..ab4c2b1112cb 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -192,13 +192,13 @@ func (p Params) ValidateBasic() error { minInitialDepositRatio, err := sdkmath.LegacyNewDecFromStr(p.MinInitialDepositRatio) if err != nil { - return fmt.Errorf("invalid mininum initial deposit ratio of proposal: %w", err) + return fmt.Errorf("invalid minimum initial deposit ratio of proposal: %w", err) } if minInitialDepositRatio.IsNegative() { - return fmt.Errorf("mininum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio) + return fmt.Errorf("minimum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio) } if minInitialDepositRatio.GT(sdkmath.LegacyOneDec()) { - return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) + return fmt.Errorf("minimum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) } proposalCancelRate, err := sdkmath.LegacyNewDecFromStr(p.ProposalCancelRatio) diff --git a/x/gov/types/v1/proposal.go b/x/gov/types/v1/proposal.go index 79bc095b56e1..61fde762248c 100644 --- a/x/gov/types/v1/proposal.go +++ b/x/gov/types/v1/proposal.go @@ -23,7 +23,7 @@ const ( ) // NewProposal creates a new Proposal instance -func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time.Time, metadata, title, summary string, proposer sdk.AccAddress, expedited bool) (Proposal, error) { +func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time.Time, metadata, title, summary string, proposer sdk.AccAddress, proposalType ProposalType) (Proposal, error) { msgs, err := sdktx.SetMsgs(messages) if err != nil { return Proposal{}, err @@ -31,6 +31,11 @@ func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time. tally := EmptyTallyResult() + // undefined proposal type defaults to standard + if proposalType == ProposalType_PROPOSAL_TYPE_UNSPECIFIED { + proposalType = ProposalType_PROPOSAL_TYPE_STANDARD + } + p := Proposal{ Id: id, Messages: msgs, @@ -42,7 +47,12 @@ func NewProposal(messages []sdk.Msg, id uint64, submitTime, depositEndTime time. Title: title, Summary: summary, Proposer: proposer.String(), - Expedited: expedited, + ProposalType: proposalType, + } + + // expedited field is deprecated but we want to keep setting it for backwards compatibility + if proposalType == ProposalType_PROPOSAL_TYPE_EXPEDITED { + p.Expedited = true } return p, nil diff --git a/x/gov/types/v1/proposals_test.go b/x/gov/types/v1/proposals_test.go index bf2902108b1b..2152a60e1bbb 100644 --- a/x/gov/types/v1/proposals_test.go +++ b/x/gov/types/v1/proposals_test.go @@ -37,7 +37,7 @@ func TestNestedAnys(t *testing.T) { testProposal := v1beta1.NewTextProposal("Proposal", "testing proposal") msgContent, err := v1.NewLegacyContent(testProposal, "cosmos1govacct") require.NoError(t, err) - proposal, err := v1.NewProposal([]sdk.Msg{msgContent}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), false) + proposal, err := v1.NewProposal([]sdk.Msg{msgContent}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) require.NotPanics(t, func() { _ = proposal.String() }) @@ -46,32 +46,34 @@ func TestNestedAnys(t *testing.T) { func TestProposalSetExpedited(t *testing.T) { const startExpedited = false - proposal, err := v1.NewProposal([]sdk.Msg{}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), startExpedited) + proposal, err := v1.NewProposal([]sdk.Msg{}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_STANDARD) require.NoError(t, err) require.Equal(t, startExpedited, proposal.Expedited) + require.Equal(t, proposal.ProposalType, v1.ProposalType_PROPOSAL_TYPE_STANDARD) - proposal, err = v1.NewProposal([]sdk.Msg{}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), !startExpedited) + proposal, err = v1.NewProposal([]sdk.Msg{}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) require.NoError(t, err) require.Equal(t, !startExpedited, proposal.Expedited) + require.Equal(t, proposal.ProposalType, v1.ProposalType_PROPOSAL_TYPE_EXPEDITED) } func TestProposalGetMinDepositFromParams(t *testing.T) { testcases := []struct { - expedited bool + proposalType v1.ProposalType expectedMinDeposit math.Int }{ { - expedited: true, + proposalType: v1.ProposalType_PROPOSAL_TYPE_EXPEDITED, expectedMinDeposit: v1.DefaultMinExpeditedDepositTokens, }, { - expedited: false, + proposalType: v1.ProposalType_PROPOSAL_TYPE_STANDARD, expectedMinDeposit: v1.DefaultMinDepositTokens, }, } for _, tc := range testcases { - proposal, err := v1.NewProposal([]sdk.Msg{}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), tc.expedited) + proposal, err := v1.NewProposal([]sdk.Msg{}, 1, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), tc.proposalType) require.NoError(t, err) actualMinDeposit := proposal.GetMinDepositFromParams(v1.DefaultParams()) diff --git a/x/gov/types/v1/query.pb.go b/x/gov/types/v1/query.pb.go index 55c18bfc19b6..4898356b7e7b 100644 --- a/x/gov/types/v1/query.pb.go +++ b/x/gov/types/v1/query.pb.go @@ -602,7 +602,7 @@ type QueryParamsResponse struct { // Deprecated: Prefer to use `params` instead. // tally_params defines the parameters related to tally. TallyParams *TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` // Deprecated: Do not use. - // params defines all the paramaters of x/gov module. + // params defines all the parameters of x/gov module. // // Since: cosmos-sdk 0.47 Params *Params `protobuf:"bytes,4,opt,name=params,proto3" json:"params,omitempty"` diff --git a/x/gov/types/v1/tally.go b/x/gov/types/v1/tally.go index 08c1fa283f3e..707496b97190 100644 --- a/x/gov/types/v1/tally.go +++ b/x/gov/types/v1/tally.go @@ -29,12 +29,13 @@ func NewValidatorGovInfo(address sdk.ValAddress, bondedTokens math.Int, delegato } // NewTallyResult creates a new TallyResult instance -func NewTallyResult(yes, abstain, no, noWithVeto math.Int) TallyResult { +func NewTallyResult(option1, option2, option3, option4, spam math.Int) TallyResult { return TallyResult{ - YesCount: yes.String(), - AbstainCount: abstain.String(), - NoCount: no.String(), - NoWithVetoCount: noWithVeto.String(), + YesCount: option1.String(), + AbstainCount: option2.String(), + NoCount: option3.String(), + NoWithVetoCount: option4.String(), + SpamCount: spam.String(), } } @@ -45,12 +46,13 @@ func NewTallyResultFromMap(results map[VoteOption]math.LegacyDec) TallyResult { results[OptionAbstain].TruncateInt(), results[OptionNo].TruncateInt(), results[OptionNoWithVeto].TruncateInt(), + results[OptionSpam].TruncateInt(), ) } // EmptyTallyResult returns an empty TallyResult. func EmptyTallyResult() TallyResult { - return NewTallyResult(math.ZeroInt(), math.ZeroInt(), math.ZeroInt(), math.ZeroInt()) + return NewTallyResult(math.ZeroInt(), math.ZeroInt(), math.ZeroInt(), math.ZeroInt(), math.ZeroInt()) } // Equals returns if two tally results are equal. @@ -58,5 +60,6 @@ func (tr TallyResult) Equals(comp TallyResult) bool { return tr.YesCount == comp.YesCount && tr.AbstainCount == comp.AbstainCount && tr.NoCount == comp.NoCount && - tr.NoWithVetoCount == comp.NoWithVetoCount + tr.NoWithVetoCount == comp.NoWithVetoCount && + tr.SpamCount == comp.SpamCount } diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 754caf7782ae..143df2acc7f1 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -60,7 +60,15 @@ type MsgSubmitProposal struct { // expedited defines if the proposal is expedited or not // // Since: cosmos-sdk 0.50 - Expedited bool `protobuf:"varint,7,opt,name=expedited,proto3" json:"expedited,omitempty"` + // Deprecated: Use the PROPOSAL_TYPE_EXPEDITED proposal type instead. + // When this field is set and no proposal_type is set, the proposal_type + // will be set to PROPOSAL_TYPE_EXPEDITED for backwards compatibility. + Expedited bool `protobuf:"varint,7,opt,name=expedited,proto3" json:"expedited,omitempty"` // Deprecated: Do not use. + // proposal_type defines the type of proposal + // When not set defaults to PROPOSAL_TYPE_STANDARD + // + // Since: cosmos-sdk 0.51 + ProposalType ProposalType `protobuf:"varint,8,opt,name=proposal_type,json=proposalType,proto3,enum=cosmos.gov.v1.ProposalType" json:"proposal_type,omitempty"` } func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } @@ -138,6 +146,7 @@ func (m *MsgSubmitProposal) GetSummary() string { return "" } +// Deprecated: Do not use. func (m *MsgSubmitProposal) GetExpedited() bool { if m != nil { return m.Expedited @@ -145,6 +154,13 @@ func (m *MsgSubmitProposal) GetExpedited() bool { return false } +func (m *MsgSubmitProposal) GetProposalType() ProposalType { + if m != nil { + return m.ProposalType + } + return ProposalType_PROPOSAL_TYPE_UNSPECIFIED +} + // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. type MsgSubmitProposalResponse struct { // proposal_id defines the unique id of the proposal. @@ -848,75 +864,77 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/tx.proto", fileDescriptor_9ff8f4a63b6fc9a9) } var fileDescriptor_9ff8f4a63b6fc9a9 = []byte{ - // 1080 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcb, 0x6f, 0x1b, 0x45, - 0x18, 0xcf, 0xe6, 0x61, 0x27, 0x93, 0x97, 0xb2, 0x72, 0xdb, 0xf5, 0x52, 0xd6, 0xee, 0x16, 0x81, - 0x95, 0x92, 0x5d, 0x1c, 0x48, 0x85, 0x4c, 0x85, 0x54, 0x87, 0x57, 0x25, 0x0c, 0xd5, 0x16, 0x8a, - 0x84, 0x90, 0xac, 0xb5, 0x77, 0xd8, 0xac, 0xea, 0xdd, 0x59, 0x79, 0xc6, 0x56, 0x7c, 0x43, 0x1c, - 0x73, 0xea, 0x99, 0x3b, 0x12, 0xe2, 0x94, 0x43, 0x6f, 0x3d, 0x71, 0xab, 0x38, 0x55, 0x9c, 0x38, - 0xb5, 0x28, 0x11, 0x04, 0xf1, 0x4f, 0x80, 0xe6, 0xb1, 0xeb, 0x7d, 0xc5, 0x29, 0x1c, 0xb8, 0x24, - 0x3b, 0xdf, 0x6b, 0xbe, 0xdf, 0xef, 0x9b, 0xef, 0xfb, 0x0c, 0x2e, 0xf7, 0x11, 0xf6, 0x11, 0x36, - 0x5d, 0x34, 0x36, 0xc7, 0x4d, 0x93, 0x1c, 0x1a, 0xe1, 0x10, 0x11, 0x24, 0xaf, 0x73, 0xb9, 0xe1, - 0xa2, 0xb1, 0x31, 0x6e, 0xaa, 0x9a, 0x30, 0xeb, 0xd9, 0x18, 0x9a, 0xe3, 0x66, 0x0f, 0x12, 0xbb, - 0x69, 0xf6, 0x91, 0x17, 0x70, 0x73, 0xf5, 0x4a, 0x3a, 0x0c, 0xf5, 0xe2, 0x8a, 0x8a, 0x8b, 0x5c, - 0xc4, 0x3e, 0x4d, 0xfa, 0x25, 0xa4, 0x55, 0x6e, 0xde, 0xe5, 0x0a, 0x71, 0x95, 0x50, 0xb9, 0x08, - 0xb9, 0x03, 0x68, 0xb2, 0x53, 0x6f, 0xf4, 0xb5, 0x69, 0x07, 0x93, 0xcc, 0x25, 0x3e, 0x76, 0xe9, - 0x25, 0x3e, 0x76, 0x85, 0x62, 0xcb, 0xf6, 0xbd, 0x00, 0x99, 0xec, 0xaf, 0x10, 0xd5, 0xb2, 0x61, - 0x88, 0xe7, 0x43, 0x4c, 0x6c, 0x3f, 0xe4, 0x06, 0xfa, 0xf7, 0x0b, 0x60, 0xab, 0x83, 0xdd, 0x7b, - 0xa3, 0x9e, 0xef, 0x91, 0xbb, 0x43, 0x14, 0x22, 0x6c, 0x0f, 0xe4, 0x37, 0xc0, 0xb2, 0x0f, 0x31, - 0xb6, 0x5d, 0x88, 0x15, 0xa9, 0xbe, 0xd0, 0x58, 0xdd, 0xad, 0x18, 0x3c, 0x92, 0x11, 0x45, 0x32, - 0x6e, 0x07, 0x13, 0x2b, 0xb6, 0x92, 0x8f, 0x24, 0xb0, 0xe9, 0x05, 0x1e, 0xf1, 0xec, 0x41, 0xd7, - 0x81, 0x21, 0xc2, 0x1e, 0x51, 0xe6, 0x99, 0x67, 0xd5, 0x10, 0xc0, 0x28, 0x69, 0x86, 0x20, 0xcd, - 0xd8, 0x47, 0x5e, 0xd0, 0xfe, 0xe0, 0xc9, 0xb3, 0xda, 0xdc, 0x8f, 0xcf, 0x6b, 0x0d, 0xd7, 0x23, - 0x07, 0xa3, 0x9e, 0xd1, 0x47, 0xbe, 0x60, 0x41, 0xfc, 0xdb, 0xc1, 0xce, 0x03, 0x93, 0x4c, 0x42, - 0x88, 0x99, 0x03, 0xfe, 0xee, 0xec, 0x78, 0x7b, 0x6d, 0x00, 0x5d, 0xbb, 0x3f, 0xe9, 0x52, 0xda, - 0xf1, 0x0f, 0x67, 0xc7, 0xdb, 0x92, 0xb5, 0x21, 0x6e, 0x7e, 0x8f, 0x5f, 0x2c, 0xbf, 0x05, 0x96, - 0x43, 0x06, 0x05, 0x0e, 0x95, 0x85, 0xba, 0xd4, 0x58, 0x69, 0x2b, 0xbf, 0x3c, 0xda, 0xa9, 0x88, - 0x3c, 0x6e, 0x3b, 0xce, 0x10, 0x62, 0x7c, 0x8f, 0x0c, 0xbd, 0xc0, 0xb5, 0x62, 0x4b, 0x59, 0xa5, - 0xa0, 0x89, 0xed, 0xd8, 0xc4, 0x56, 0x16, 0xa9, 0x97, 0x15, 0x9f, 0xe5, 0x0a, 0x58, 0x22, 0x1e, - 0x19, 0x40, 0x65, 0x89, 0x29, 0xf8, 0x41, 0x56, 0x40, 0x19, 0x8f, 0x7c, 0xdf, 0x1e, 0x4e, 0x94, - 0x12, 0x93, 0x47, 0x47, 0xf9, 0x2a, 0x58, 0x81, 0x87, 0x21, 0x74, 0x3c, 0x02, 0x1d, 0xa5, 0x5c, - 0x97, 0x1a, 0xcb, 0xd6, 0x54, 0xd0, 0x6a, 0x7e, 0x7b, 0x76, 0xbc, 0x1d, 0x5f, 0x7c, 0x74, 0x76, - 0xbc, 0x5d, 0x4b, 0xe0, 0x1d, 0x37, 0xcd, 0x5c, 0x45, 0xf4, 0x5b, 0xa0, 0x9a, 0x13, 0x5a, 0x10, - 0x87, 0x28, 0xc0, 0x50, 0xae, 0x81, 0xd5, 0x50, 0xc8, 0xba, 0x9e, 0xa3, 0x48, 0x75, 0xa9, 0xb1, - 0x68, 0x81, 0x48, 0x74, 0xc7, 0xd1, 0x1f, 0x4b, 0xa0, 0xd2, 0xc1, 0xee, 0xfb, 0x87, 0xb0, 0xff, - 0x31, 0x63, 0x6f, 0x1f, 0x05, 0x04, 0x06, 0x44, 0xfe, 0x04, 0x94, 0xfb, 0xfc, 0x93, 0x79, 0x9d, - 0x53, 0xe7, 0xb6, 0xf6, 0xf3, 0xa3, 0x1d, 0x35, 0xd5, 0x0a, 0x51, 0x15, 0x99, 0xaf, 0x15, 0x05, - 0xa1, 0xb8, 0xed, 0x11, 0x39, 0x40, 0x43, 0x8f, 0x4c, 0x94, 0x79, 0xc6, 0xc9, 0x54, 0xd0, 0xda, - 0xa3, 0xb8, 0xa7, 0x67, 0x0a, 0x5c, 0xcf, 0x01, 0xcf, 0x25, 0xa9, 0x6b, 0xe0, 0x6a, 0x91, 0x3c, - 0x82, 0xaf, 0xff, 0x2e, 0x81, 0x72, 0x07, 0xbb, 0xf7, 0x11, 0x81, 0xf2, 0x5e, 0x01, 0x15, 0xed, - 0xca, 0x5f, 0xcf, 0x6a, 0x49, 0x31, 0x7f, 0x35, 0x09, 0x82, 0x64, 0x03, 0x2c, 0x8d, 0x11, 0x81, - 0x43, 0x9e, 0xf3, 0x8c, 0xe7, 0xc2, 0xcd, 0xe4, 0x26, 0x28, 0xa1, 0x90, 0x78, 0x28, 0x60, 0xef, - 0x6b, 0x63, 0xfa, 0xc8, 0x39, 0x3b, 0x06, 0xcd, 0xe5, 0x53, 0x66, 0x60, 0x09, 0xc3, 0x59, 0xcf, - 0xab, 0xf5, 0x0a, 0x25, 0x86, 0x87, 0xa6, 0xa4, 0x5c, 0xca, 0x91, 0x42, 0xe3, 0xe9, 0x5b, 0x60, - 0x53, 0x7c, 0xc6, 0xd0, 0xff, 0x96, 0x62, 0xd9, 0x17, 0xd0, 0x73, 0x0f, 0x08, 0x74, 0xfe, 0x2f, - 0x0a, 0xde, 0x01, 0x65, 0x8e, 0x0c, 0x2b, 0x0b, 0xac, 0xd1, 0xaf, 0x65, 0x38, 0x88, 0x12, 0x4a, - 0x70, 0x11, 0x79, 0xcc, 0x24, 0xe3, 0xf5, 0x34, 0x19, 0x2f, 0x17, 0x92, 0x11, 0x05, 0xd7, 0xab, - 0xe0, 0x4a, 0x46, 0x14, 0x93, 0xf3, 0x87, 0x04, 0x40, 0x07, 0xbb, 0xd1, 0x54, 0xf8, 0x8f, 0xbc, - 0xdc, 0x04, 0x2b, 0x62, 0xa0, 0xa1, 0x8b, 0xb9, 0x99, 0x9a, 0xca, 0xb7, 0x40, 0xc9, 0xf6, 0xd1, - 0x28, 0x20, 0x82, 0x9e, 0x19, 0x73, 0x70, 0x85, 0xce, 0x41, 0x7e, 0xb3, 0xf0, 0x69, 0xdd, 0x60, - 0xad, 0x12, 0x47, 0xa3, 0x44, 0x28, 0x39, 0x22, 0x04, 0x32, 0xbd, 0x02, 0xe4, 0xe9, 0x29, 0x86, - 0xff, 0x98, 0xbf, 0x8d, 0xcf, 0x43, 0xc7, 0x26, 0xf0, 0xae, 0x3d, 0xb4, 0x7d, 0x4c, 0xc1, 0x4c, - 0xfb, 0x53, 0xba, 0x08, 0x4c, 0x6c, 0x2a, 0xbf, 0x0d, 0x4a, 0x21, 0x8b, 0xc0, 0x18, 0x58, 0xdd, - 0xbd, 0x94, 0xa9, 0x35, 0x0f, 0x9f, 0x02, 0xc2, 0xed, 0x5b, 0x37, 0xf3, 0x3d, 0x7f, 0x3d, 0x01, - 0xe4, 0x30, 0xda, 0x95, 0x99, 0x4c, 0x45, 0x5d, 0x93, 0xa2, 0x18, 0xd8, 0x91, 0xc4, 0x76, 0xd6, - 0xbe, 0x1d, 0xf4, 0xe1, 0x20, 0xb1, 0xb3, 0x0a, 0xca, 0xbb, 0x99, 0x29, 0x6f, 0xaa, 0xb2, 0xc9, - 0x35, 0x31, 0xff, 0xa2, 0x6b, 0xa2, 0xb5, 0x9e, 0x1a, 0xde, 0xfa, 0x4f, 0x12, 0x9b, 0xcc, 0xe9, - 0x64, 0xe2, 0xc9, 0xfc, 0xef, 0x93, 0xba, 0x03, 0xd6, 0xfb, 0x2c, 0x16, 0x74, 0xba, 0x74, 0x59, - 0x0b, 0xc2, 0xd5, 0xdc, 0x5c, 0xfe, 0x2c, 0xda, 0xe4, 0xed, 0x65, 0xca, 0xfa, 0xc3, 0xe7, 0x35, - 0xc9, 0x5a, 0x8b, 0x5c, 0xa9, 0x52, 0x7e, 0x0d, 0x6c, 0xc6, 0xa1, 0x0e, 0x58, 0x73, 0xb0, 0x69, - 0xb5, 0x68, 0x6d, 0x44, 0xe2, 0x8f, 0x98, 0x74, 0xf7, 0xcf, 0x45, 0xb0, 0xd0, 0xc1, 0xae, 0xfc, - 0x15, 0xd8, 0xc8, 0xfc, 0x10, 0xa8, 0x67, 0xea, 0x9c, 0xdb, 0x41, 0x6a, 0xe3, 0x22, 0x8b, 0x98, - 0x0b, 0x08, 0xb6, 0xf2, 0x0b, 0xe8, 0x7a, 0xde, 0x3d, 0x67, 0xa4, 0xde, 0x78, 0x01, 0xa3, 0xf8, - 0x9a, 0x77, 0xc1, 0x22, 0xdb, 0x04, 0x97, 0xf3, 0x4e, 0x54, 0xae, 0x6a, 0xc5, 0xf2, 0xd8, 0xff, - 0x3e, 0x58, 0x4b, 0x8d, 0xd3, 0x73, 0xec, 0x23, 0xbd, 0xfa, 0xea, 0x6c, 0x7d, 0x1c, 0xf7, 0x43, - 0x50, 0x8e, 0x26, 0x51, 0x35, 0xef, 0x22, 0x54, 0xea, 0xb5, 0x73, 0x55, 0xc9, 0x04, 0x53, 0x3d, - 0x5d, 0x90, 0x60, 0x52, 0x5f, 0x94, 0x60, 0x51, 0x5b, 0xd1, 0xea, 0x67, 0x5a, 0xaa, 0xa0, 0xfa, - 0x69, 0x8b, 0xa2, 0xea, 0x17, 0x77, 0x82, 0xba, 0xf4, 0x0d, 0x1d, 0x0b, 0xed, 0xbd, 0x27, 0x27, - 0x9a, 0xf4, 0xf4, 0x44, 0x93, 0x7e, 0x3b, 0xd1, 0xa4, 0x87, 0xa7, 0xda, 0xdc, 0xd3, 0x53, 0x6d, - 0xee, 0xd7, 0x53, 0x6d, 0xee, 0xcb, 0x97, 0x78, 0x24, 0xec, 0x3c, 0x30, 0x3c, 0x24, 0xe6, 0x02, - 0xfb, 0xe9, 0x47, 0x7f, 0x68, 0x97, 0xd8, 0xb3, 0x7f, 0xf3, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x04, 0x0a, 0x84, 0x9f, 0xa8, 0x0b, 0x00, 0x00, + // 1114 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcb, 0x6f, 0xdc, 0x44, + 0x18, 0xcf, 0xe4, 0xb5, 0xc9, 0xe4, 0xa5, 0x8c, 0xb6, 0xad, 0xe3, 0x16, 0xef, 0xd6, 0x45, 0xb0, + 0x4a, 0x89, 0xcd, 0x06, 0x52, 0xa1, 0xa5, 0x42, 0x74, 0xc3, 0xab, 0x12, 0x81, 0xca, 0x2d, 0x45, + 0x42, 0x48, 0x91, 0xb3, 0x1e, 0x1c, 0xab, 0x6b, 0x8f, 0xb5, 0x33, 0xbb, 0xca, 0xde, 0x10, 0xc7, + 0x9c, 0x7a, 0xe6, 0x2f, 0x40, 0x9c, 0x72, 0xe8, 0xad, 0x27, 0x6e, 0x15, 0xa7, 0x8a, 0x13, 0xa7, + 0x16, 0x25, 0x82, 0x20, 0xf8, 0x23, 0x40, 0x33, 0x1e, 0x7b, 0xfd, 0xca, 0xa6, 0x70, 0xe8, 0x65, + 0xd7, 0xf3, 0xbd, 0xe6, 0xfb, 0xfd, 0xbe, 0x6f, 0xbe, 0x19, 0x78, 0xb1, 0x43, 0xa8, 0x4f, 0xa8, + 0xe9, 0x92, 0x81, 0x39, 0x68, 0x9a, 0xec, 0xc0, 0x08, 0x7b, 0x84, 0x11, 0xb4, 0x14, 0xc9, 0x0d, + 0x97, 0x0c, 0x8c, 0x41, 0x53, 0xd5, 0xa4, 0xd9, 0x9e, 0x4d, 0xb1, 0x39, 0x68, 0xee, 0x61, 0x66, + 0x37, 0xcd, 0x0e, 0xf1, 0x82, 0xc8, 0x5c, 0xbd, 0x94, 0x0d, 0xc3, 0xbd, 0x22, 0x45, 0xd5, 0x25, + 0x2e, 0x11, 0x9f, 0x26, 0xff, 0x92, 0xd2, 0xb5, 0xc8, 0x7c, 0x37, 0x52, 0xc8, 0xad, 0xa4, 0xca, + 0x25, 0xc4, 0xed, 0x62, 0x53, 0xac, 0xf6, 0xfa, 0xdf, 0x98, 0x76, 0x30, 0xcc, 0x6d, 0xe2, 0x53, + 0x97, 0x6f, 0xe2, 0x53, 0x57, 0x2a, 0x56, 0x6d, 0xdf, 0x0b, 0x88, 0x29, 0x7e, 0xa5, 0xa8, 0x96, + 0x0f, 0xc3, 0x3c, 0x1f, 0x53, 0x66, 0xfb, 0x61, 0x64, 0xa0, 0xff, 0x3d, 0x05, 0x57, 0x77, 0xa8, + 0x7b, 0xb7, 0xbf, 0xe7, 0x7b, 0xec, 0x4e, 0x8f, 0x84, 0x84, 0xda, 0x5d, 0xf4, 0x26, 0x9c, 0xf3, + 0x31, 0xa5, 0xb6, 0x8b, 0xa9, 0x02, 0xea, 0x53, 0x8d, 0x85, 0xcd, 0xaa, 0x11, 0x45, 0x32, 0xe2, + 0x48, 0xc6, 0xad, 0x60, 0x68, 0x25, 0x56, 0xe8, 0x10, 0xc0, 0x15, 0x2f, 0xf0, 0x98, 0x67, 0x77, + 0x77, 0x1d, 0x1c, 0x12, 0xea, 0x31, 0x65, 0x52, 0x78, 0xae, 0x19, 0x12, 0x18, 0x27, 0xcd, 0x90, + 0xa4, 0x19, 0xdb, 0xc4, 0x0b, 0xda, 0x1f, 0x3d, 0x79, 0x56, 0x9b, 0xf8, 0xf1, 0x79, 0xad, 0xe1, + 0x7a, 0x6c, 0xbf, 0xbf, 0x67, 0x74, 0x88, 0x2f, 0x59, 0x90, 0x7f, 0x1b, 0xd4, 0x79, 0x60, 0xb2, + 0x61, 0x88, 0xa9, 0x70, 0xa0, 0xdf, 0x9f, 0x1e, 0xad, 0x2f, 0x76, 0xb1, 0x6b, 0x77, 0x86, 0xbb, + 0x9c, 0x76, 0xfa, 0xc3, 0xe9, 0xd1, 0x3a, 0xb0, 0x96, 0xe5, 0xce, 0x1f, 0x44, 0x1b, 0xa3, 0xb7, + 0xe1, 0x5c, 0x28, 0xa0, 0xe0, 0x9e, 0x32, 0x55, 0x07, 0x8d, 0xf9, 0xb6, 0xf2, 0xcb, 0xa3, 0x8d, + 0xaa, 0xcc, 0xe3, 0x96, 0xe3, 0xf4, 0x30, 0xa5, 0x77, 0x59, 0xcf, 0x0b, 0x5c, 0x2b, 0xb1, 0x44, + 0x2a, 0x07, 0xcd, 0x6c, 0xc7, 0x66, 0xb6, 0x32, 0xcd, 0xbd, 0xac, 0x64, 0x8d, 0xaa, 0x70, 0x86, + 0x79, 0xac, 0x8b, 0x95, 0x19, 0xa1, 0x88, 0x16, 0x48, 0x81, 0x15, 0xda, 0xf7, 0x7d, 0xbb, 0x37, + 0x54, 0x66, 0x85, 0x3c, 0x5e, 0xa2, 0x3a, 0x9c, 0xc7, 0x07, 0x21, 0x76, 0x3c, 0x86, 0x1d, 0xa5, + 0x52, 0x07, 0x8d, 0xb9, 0xf6, 0xa4, 0x02, 0xac, 0x91, 0x10, 0xbd, 0x0f, 0x97, 0x42, 0x49, 0xf7, + 0x2e, 0x47, 0xa8, 0xcc, 0xd5, 0x41, 0x63, 0x79, 0xf3, 0xb2, 0x91, 0xe9, 0x38, 0x23, 0x2e, 0xc9, + 0xbd, 0x61, 0x88, 0xad, 0xc5, 0x30, 0xb5, 0x6a, 0x35, 0xbf, 0x3b, 0x3d, 0x5a, 0x4f, 0xd2, 0x3f, + 0x3c, 0x3d, 0x5a, 0xaf, 0xa5, 0x58, 0x1b, 0x34, 0xcd, 0x42, 0x5d, 0xf5, 0x9b, 0x70, 0xad, 0x20, + 0xb4, 0x30, 0x0d, 0x49, 0x40, 0x31, 0xaa, 0xc1, 0x85, 0x24, 0x23, 0xcf, 0x51, 0x40, 0x1d, 0x34, + 0xa6, 0x2d, 0x18, 0x8b, 0x6e, 0x3b, 0xfa, 0x63, 0x00, 0xab, 0x3b, 0xd4, 0xfd, 0xf0, 0x00, 0x77, + 0x3e, 0x15, 0x35, 0xd8, 0x26, 0x01, 0xc3, 0x01, 0x43, 0x9f, 0xc1, 0x4a, 0x27, 0xfa, 0x14, 0x5e, + 0x67, 0x74, 0x4b, 0x5b, 0xfb, 0xf9, 0xd1, 0x86, 0x9a, 0x81, 0x17, 0xf7, 0x82, 0xf0, 0xb5, 0xe2, + 0x20, 0xe8, 0x0a, 0x9c, 0xb7, 0xfb, 0x6c, 0x9f, 0xf4, 0x3c, 0x36, 0x54, 0x26, 0x05, 0xb3, 0x23, + 0x41, 0x6b, 0x8b, 0xe3, 0x1e, 0xad, 0x39, 0x70, 0xbd, 0x00, 0xbc, 0x90, 0xa4, 0xae, 0xc1, 0x2b, + 0x65, 0xf2, 0x18, 0xbe, 0xfe, 0x3b, 0x80, 0x95, 0x1d, 0xea, 0xde, 0x27, 0x0c, 0xa3, 0xad, 0x12, + 0x2a, 0xda, 0xd5, 0xbf, 0x9e, 0xd5, 0xd2, 0xe2, 0xa8, 0xf7, 0x52, 0x04, 0x21, 0x03, 0xce, 0x0c, + 0x08, 0xc3, 0xbd, 0x28, 0xe7, 0x31, 0x4d, 0x17, 0x99, 0xa1, 0x26, 0x9c, 0x25, 0x21, 0xf3, 0x48, + 0x20, 0xba, 0x74, 0x79, 0x74, 0x54, 0x64, 0xf1, 0x79, 0x2e, 0x9f, 0x0b, 0x03, 0x4b, 0x1a, 0x8e, + 0x6b, 0xd2, 0xd6, 0xab, 0x9c, 0x98, 0x28, 0x34, 0x27, 0xe5, 0x42, 0x81, 0x14, 0x1e, 0x4f, 0x5f, + 0x85, 0x2b, 0xf2, 0x33, 0x81, 0xfe, 0x0f, 0x48, 0x64, 0x5f, 0x62, 0xcf, 0xdd, 0xe7, 0xfd, 0xf9, + 0x92, 0x28, 0x78, 0x17, 0x56, 0x22, 0x64, 0x54, 0x99, 0x12, 0xe3, 0xe2, 0x6a, 0x8e, 0x83, 0x38, + 0xa1, 0x14, 0x17, 0xb1, 0xc7, 0x58, 0x32, 0xde, 0xc8, 0x92, 0xf1, 0x4a, 0x29, 0x19, 0x71, 0x70, + 0x7d, 0x0d, 0x5e, 0xca, 0x89, 0x12, 0x72, 0xfe, 0x00, 0x10, 0xee, 0x50, 0x37, 0x9e, 0x2d, 0xff, + 0x93, 0x97, 0x1b, 0x70, 0x5e, 0x8e, 0x45, 0x72, 0x3e, 0x37, 0x23, 0x53, 0x74, 0x13, 0xce, 0xda, + 0x3e, 0xe9, 0x07, 0x4c, 0xd2, 0x33, 0x66, 0x9a, 0xce, 0xf3, 0x69, 0x1a, 0xed, 0x2c, 0x7d, 0x5a, + 0xd7, 0xc5, 0x51, 0x49, 0xa2, 0x71, 0x22, 0x94, 0x02, 0x11, 0x12, 0x99, 0x5e, 0x85, 0x68, 0xb4, + 0x4a, 0xe0, 0x3f, 0x8e, 0x7a, 0xe3, 0x8b, 0xd0, 0xb1, 0x19, 0xbe, 0x63, 0xf7, 0x6c, 0x9f, 0x72, + 0x30, 0xa3, 0xf3, 0x09, 0xce, 0x03, 0x93, 0x98, 0xa2, 0x77, 0xe0, 0x6c, 0x28, 0x22, 0x08, 0x06, + 0x16, 0x36, 0x2f, 0xe4, 0x87, 0x9d, 0x50, 0x66, 0x80, 0x44, 0xf6, 0xad, 0x1b, 0xc5, 0x33, 0x7f, + 0x2d, 0x05, 0xe4, 0x20, 0xbe, 0x71, 0x73, 0x99, 0xca, 0xba, 0xa6, 0x45, 0x09, 0xb0, 0x43, 0x20, + 0x6e, 0xbe, 0x6d, 0x3b, 0xe8, 0xe0, 0x6e, 0xea, 0xe6, 0x2b, 0x29, 0xef, 0x4a, 0xae, 0xbc, 0x99, + 0xca, 0xa6, 0x2f, 0x9b, 0xc9, 0x17, 0xbd, 0x6c, 0x5a, 0x4b, 0x99, 0xe1, 0xad, 0xff, 0x04, 0xc4, + 0x64, 0xce, 0x26, 0x93, 0x4c, 0xe6, 0xff, 0x9e, 0xd4, 0x6d, 0xb8, 0xd4, 0x11, 0xb1, 0xb0, 0xb3, + 0xcb, 0xaf, 0x7c, 0x49, 0xb8, 0x5a, 0x98, 0xcb, 0xf7, 0xe2, 0xf7, 0x40, 0x7b, 0x8e, 0xb3, 0xfe, + 0xf0, 0x79, 0x0d, 0x58, 0x8b, 0xb1, 0x2b, 0x57, 0xa2, 0xd7, 0xe1, 0x4a, 0x12, 0x6a, 0x5f, 0x1c, + 0x0e, 0x31, 0xad, 0xa6, 0xad, 0xe5, 0x58, 0xfc, 0x89, 0x90, 0x6e, 0xfe, 0x39, 0x0d, 0xa7, 0x76, + 0xa8, 0x8b, 0xbe, 0x86, 0xcb, 0xb9, 0xe7, 0x44, 0x3d, 0x57, 0xe7, 0xc2, 0x1d, 0xa4, 0x36, 0xce, + 0xb3, 0x48, 0xb8, 0xc0, 0x70, 0xb5, 0x78, 0x01, 0x5d, 0x2b, 0xba, 0x17, 0x8c, 0xd4, 0xeb, 0x2f, + 0x60, 0x94, 0x6c, 0xf3, 0x1e, 0x9c, 0x16, 0x37, 0xc1, 0xc5, 0xa2, 0x13, 0x97, 0xab, 0x5a, 0xb9, + 0x3c, 0xf1, 0xbf, 0x0f, 0x17, 0x33, 0xe3, 0xf4, 0x0c, 0xfb, 0x58, 0xaf, 0xbe, 0x36, 0x5e, 0x9f, + 0xc4, 0xfd, 0x18, 0x56, 0xe2, 0x49, 0xb4, 0x56, 0x74, 0x91, 0x2a, 0xf5, 0xea, 0x99, 0xaa, 0x74, + 0x82, 0x99, 0x33, 0x5d, 0x92, 0x60, 0x5a, 0x5f, 0x96, 0x60, 0xd9, 0xb1, 0xe2, 0xd5, 0xcf, 0x1d, + 0xa9, 0x92, 0xea, 0x67, 0x2d, 0xca, 0xaa, 0x5f, 0x7e, 0x12, 0xd4, 0x99, 0x6f, 0xf9, 0x58, 0x68, + 0x6f, 0x3d, 0x39, 0xd6, 0xc0, 0xd3, 0x63, 0x0d, 0xfc, 0x76, 0xac, 0x81, 0x87, 0x27, 0xda, 0xc4, + 0xd3, 0x13, 0x6d, 0xe2, 0xd7, 0x13, 0x6d, 0xe2, 0xab, 0xcb, 0x51, 0x24, 0xea, 0x3c, 0x30, 0x3c, + 0x22, 0xe7, 0x82, 0x78, 0x40, 0xf2, 0xe7, 0xfa, 0xac, 0x68, 0xfb, 0xb7, 0xfe, 0x0d, 0x00, 0x00, + 0xff, 0xff, 0x46, 0x1f, 0x89, 0xe5, 0xee, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1261,6 +1279,11 @@ func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ProposalType != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalType)) + i-- + dAtA[i] = 0x40 + } if m.Expedited { i-- if m.Expedited { @@ -1831,6 +1854,9 @@ func (m *MsgSubmitProposal) Size() (n int) { if m.Expedited { n += 2 } + if m.ProposalType != 0 { + n += 1 + sovTx(uint64(m.ProposalType)) + } return n } @@ -2278,6 +2304,25 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } } m.Expedited = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalType", wireType) + } + m.ProposalType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalType |= ProposalType(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/vote.go b/x/gov/types/v1/vote.go index edadc770756b..068952d71099 100644 --- a/x/gov/types/v1/vote.go +++ b/x/gov/types/v1/vote.go @@ -11,11 +11,17 @@ import ( ) const ( - OptionEmpty = VoteOption_VOTE_OPTION_UNSPECIFIED - OptionYes = VoteOption_VOTE_OPTION_YES - OptionNo = VoteOption_VOTE_OPTION_NO - OptionNoWithVeto = VoteOption_VOTE_OPTION_NO_WITH_VETO - OptionAbstain = VoteOption_VOTE_OPTION_ABSTAIN + OptionEmpty = VoteOption_VOTE_OPTION_UNSPECIFIED + OptionOne = VoteOption_VOTE_OPTION_ONE + OptionTwo = VoteOption_VOTE_OPTION_TWO + OptionThree = VoteOption_VOTE_OPTION_THREE + OptionFour = VoteOption_VOTE_OPTION_FOUR + OptionSpam = VoteOption_VOTE_OPTION_SPAM + + OptionYes = OptionOne + OptionNo = OptionThree + OptionNoWithVeto = OptionFour + OptionAbstain = OptionTwo ) // NewVote creates a new Vote instance @@ -103,7 +109,7 @@ func (v WeightedVoteOptions) String() string { func VoteOptionFromString(str string) (VoteOption, error) { option, ok := VoteOption_value[str] if !ok { - return OptionEmpty, fmt.Errorf("'%s' is not a valid vote option, available options: yes/no/no_with_veto/abstain", str) + return OptionEmpty, fmt.Errorf("'%s' is not a valid vote option, available options: yes,option_one/no,option_three/no_with_veto,option_four/abstain,option_two/spam", str) } return VoteOption(option), nil } @@ -132,10 +138,11 @@ func WeightedVoteOptionsFromString(str string) (WeightedVoteOptions, error) { // ValidVoteOption returns true if the vote option is valid and false otherwise. func ValidVoteOption(option VoteOption) bool { - if option == OptionYes || - option == OptionAbstain || - option == OptionNo || - option == OptionNoWithVeto { + if option == OptionOne || + option == OptionTwo || + option == OptionThree || + option == OptionFour || + option == OptionSpam { return true } return false diff --git a/x/group/README.md b/x/group/README.md index 71d91ccb4a24..a6e703bdaa19 100644 --- a/x/group/README.md +++ b/x/group/README.md @@ -85,7 +85,7 @@ A decision policy is the mechanism by which members of a group can vote on proposals, as well as the rules that dictate whether a proposal should pass or not based on its tally outcome. -All decision policies generally would have a mininum execution period and a +All decision policies generally would have a minimum execution period and a maximum voting window. The minimum execution period is the minimum amount of time that must pass after submission in order for a proposal to potentially be executed, and it may be set to 0. The maximum voting window is the maximum time after submission that a proposal may @@ -210,7 +210,7 @@ Proposals and votes are automatically pruned to avoid state bloat. Votes are pruned: * either after a successful tally, i.e. a tally whose result passes the decision - policy's rules, which can be trigged by a `Msg/Exec` or a + policy's rules, which can be triggered by a `Msg/Exec` or a `Msg/{SubmitProposal,Vote}` with the `Exec` field set, * or on `EndBlock` right after the proposal's voting period end. This applies to proposals with status `aborted` or `withdrawn` too. diff --git a/x/group/go.mod b/x/group/go.mod index de6e8696dfa7..140105d86cbc 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -41,7 +41,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -120,7 +122,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -146,14 +148,18 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/group/go.sum b/x/group/go.sum index 2352f4d8b9be..35a9b5b46e2d 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -639,8 +641,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -801,6 +803,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/group/internal/orm/sequence_property_test.go b/x/group/internal/orm/sequence_property_test.go index ac73762d5528..87aa0a65dbfb 100644 --- a/x/group/internal/orm/sequence_property_test.go +++ b/x/group/internal/orm/sequence_property_test.go @@ -15,7 +15,7 @@ func TestSequence(t *testing.T) { func testSequenceMachine(t *rapid.T) { // Init sets up the real Sequence, including choosing a random initial value, - // and intialises the model state + // and initializes the model state ctx := NewMockContext() store := ctx.KVStore(storetypes.NewKVStoreKey("test")) diff --git a/x/mint/go.mod b/x/mint/go.mod index aeb0145949ef..0d6fa6698e71 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -31,7 +31,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -111,7 +113,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -138,15 +140,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/mint/go.sum b/x/mint/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/nft/go.mod b/x/nft/go.mod index 416d2e419c0c..f563907396c8 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -31,7 +31,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -111,7 +113,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -138,15 +140,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/nft/internal/conv/doc.go b/x/nft/internal/conv/doc.go index 1c86f5c14409..4b45d1ab53f9 100644 --- a/x/nft/internal/conv/doc.go +++ b/x/nft/internal/conv/doc.go @@ -1,2 +1,2 @@ -// Package conv provides internal functions for convertions and data manipulation +// Package conv provides internal functions for conversions and data manipulation package conv diff --git a/x/nft/keeper/nft_batch_test.go b/x/nft/keeper/nft_batch_test.go index 2e356f0fb760..8163d2fe843d 100644 --- a/x/nft/keeper/nft_batch_test.go +++ b/x/nft/keeper/nft_batch_test.go @@ -58,7 +58,7 @@ func (s *TestSuite) TestBatchMint() { true, }, { - "faild with repeated nft", + "failed with repeated nft", func(tokens []nft.NFT) { s.saveClass(tokens) }, @@ -70,7 +70,7 @@ func (s *TestSuite) TestBatchMint() { false, }, { - "faild with not exist class", + "failed with not exist class", func(tokens []nft.NFT) { // do nothing }, @@ -82,7 +82,7 @@ func (s *TestSuite) TestBatchMint() { false, }, { - "faild with exist nft", + "failed with exist nft", func(tokens []nft.NFT) { s.saveClass(tokens) idx := rand.Intn(len(tokens)) diff --git a/x/nft/simulation/operations.go b/x/nft/simulation/operations.go index 82163ae009a3..5128d8147749 100644 --- a/x/nft/simulation/operations.go +++ b/x/nft/simulation/operations.go @@ -92,7 +92,7 @@ func SimulateMsgSend( return simtypes.NoOpMsg(nft.ModuleName, TypeMsgSend, err.Error()), nil, err } - recieverStr, err := ak.AddressCodec().BytesToString(receiver.Address.Bytes()) + receiverStr, err := ak.AddressCodec().BytesToString(receiver.Address.Bytes()) if err != nil { return simtypes.NoOpMsg(nft.ModuleName, TypeMsgSend, err.Error()), nil, err } @@ -101,7 +101,7 @@ func SimulateMsgSend( ClassId: n.ClassId, Id: n.Id, Sender: senderStr, - Receiver: recieverStr, + Receiver: receiverStr, } tx, err := simtestutil.GenSignedMockTx( diff --git a/x/params/README.md b/x/params/README.md index f8d374d0c28b..f26ec5c92bd8 100644 --- a/x/params/README.md +++ b/x/params/README.md @@ -4,7 +4,7 @@ sidebar_position: 1 # `x/params` -> Note: The Params module has been depreacted in favour of each module housing its own parameters. +> Note: The Params module has been deprecated in favour of each module housing its own parameters. ## Abstract diff --git a/x/params/go.mod b/x/params/go.mod index d964e8cad075..47a77cd08397 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -34,7 +34,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -112,7 +114,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -138,15 +140,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/params/go.sum b/x/params/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/params/types/querier.go b/x/params/types/querier.go index afcc773ff24e..43914df66ad8 100644 --- a/x/params/types/querier.go +++ b/x/params/types/querier.go @@ -12,7 +12,7 @@ type QuerySubspaceParams struct { Key string } -// SubspaceParamsResponse defines the response for quering parameters by subspace. +// SubspaceParamsResponse defines the response for querying parameters by subspace. type SubspaceParamsResponse struct { Subspace string Key string diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index b3a1e07b1d1e..ed7e101aa8ca 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -34,7 +34,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -114,7 +116,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -141,15 +143,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/simulation/log.go b/x/simulation/log.go index b22709b65414..b1b067510c90 100644 --- a/x/simulation/log.go +++ b/x/simulation/log.go @@ -7,7 +7,7 @@ import ( "time" ) -// log writter +// log writer type LogWriter interface { AddEntry(OperationEntry) PrintLogs() @@ -22,12 +22,12 @@ func NewLogWriter(testingmode bool) LogWriter { return &StandardLogWriter{} } -// log writter +// log writer type StandardLogWriter struct { OpEntries []OperationEntry `json:"op_entries" yaml:"op_entries"` } -// add an entry to the log writter +// add an entry to the log writer func (lw *StandardLogWriter) AddEntry(opEntry OperationEntry) { lw.OpEntries = append(lw.OpEntries, opEntry) } @@ -67,7 +67,7 @@ func createLogFile() *os.File { return f } -// dummy log writter +// dummy log writer type DummyLogWriter struct{} // do nothing diff --git a/x/simulation/simulate.go b/x/simulation/simulate.go index 779cad91c1b9..1da741088559 100644 --- a/x/simulation/simulate.go +++ b/x/simulation/simulate.go @@ -297,7 +297,7 @@ type blockSimFn func( ) (opCount int) // Returns a function to simulate blocks. Written like this to avoid constant -// parameters being passed everytime, to minimize memory overhead. +// parameters being passed every time, to minimize memory overhead. func createBlockSimulator(tb testing.TB, testingMode bool, w io.Writer, params Params, event func(route, op, evResult string), ops WeightedOperations, operationQueue OperationQueue, timeOperationQueue []simulation.FutureOperation, diff --git a/x/slashing/README.md b/x/slashing/README.md index 591a9a73a1dc..60848fb4c1d6 100644 --- a/x/slashing/README.md +++ b/x/slashing/README.md @@ -53,7 +53,7 @@ blocks. Validators who are _bonded_ are _at stake_, meaning that part or all of their stake and their delegators' stake is at risk if they commit a protocol fault. For each of these validators we keep a `ValidatorSigningInfo` record that contains -information partaining to validator's liveness and other infraction related +information pertaining to validator's liveness and other infraction related attributes. ### Tombstone Caps diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 0abd808d3083..462354612dac 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -38,7 +38,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -116,7 +118,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -143,15 +145,19 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/slashing/keeper/signing_info.go b/x/slashing/keeper/signing_info.go index 80ebc6550305..51e258fea960 100644 --- a/x/slashing/keeper/signing_info.go +++ b/x/slashing/keeper/signing_info.go @@ -3,6 +3,7 @@ package keeper import ( "context" "errors" + "fmt" "time" "github.com/bits-and-blooms/bitset" @@ -22,23 +23,22 @@ func (k Keeper) HasValidatorSigningInfo(ctx context.Context, consAddr sdk.ConsAd } // JailUntil attempts to set a validator's JailedUntil attribute in its signing -// info. It will panic if the signing info does not exist for the validator. +// info. func (k Keeper) JailUntil(ctx context.Context, consAddr sdk.ConsAddress, jailTime time.Time) error { signInfo, err := k.ValidatorSigningInfo.Get(ctx, consAddr) if err != nil { - return errorsmod.Wrap(err, "cannot jail validator that does not have any signing information") + return errorsmod.Wrap(err, fmt.Sprintf("cannot jail validator with consensus address %s that does not have any signing information", consAddr.String())) } signInfo.JailedUntil = jailTime return k.ValidatorSigningInfo.Set(ctx, consAddr, signInfo) } -// Tombstone attempts to tombstone a validator. It will panic if signing info for -// the given validator does not exist. +// Tombstone attempts to tombstone a validator. func (k Keeper) Tombstone(ctx context.Context, consAddr sdk.ConsAddress) error { signInfo, err := k.ValidatorSigningInfo.Get(ctx, consAddr) if err != nil { - return types.ErrNoSigningInfoFound.Wrap("cannot tombstone validator that does not have any signing information") + return types.ErrNoSigningInfoFound.Wrap(fmt.Sprintf("cannot tombstone validator with consensus address %s that does not have any signing information", consAddr.String())) } if signInfo.Tombstoned { diff --git a/x/staking/README.md b/x/staking/README.md index c011a593dd34..dd3c6d56b75e 100644 --- a/x/staking/README.md +++ b/x/staking/README.md @@ -464,7 +464,7 @@ When a Validator is slashed, the following occurs: * The total `slashAmount` is calculated as the `slashFactor` (a chain parameter) \* `TokensFromConsensusPower`, the total number of tokens bonded to the validator at the time of the infraction. -* Every unbonding delegation and pseudo-unbonding redelegation such that the infraction occured before the unbonding or +* Every unbonding delegation and pseudo-unbonding redelegation such that the infraction occurred before the unbonding or redelegation began from the validator are slashed by the `slashFactor` percentage of the initialBalance. * Each amount slashed from redelegations and unbonding delegations is subtracted from the total slash amount. @@ -472,7 +472,7 @@ When a Validator is slashed, the following occurs: `NonBondedPool` depending on the validator's status. This reduces the total supply of tokens. In the case of a slash due to any infraction that requires evidence to submitted (for example double-sign), the slash -occurs at the block where the evidence is included, not at the block where the infraction occured. +occurs at the block where the evidence is included, not at the block where the infraction occurred. Put otherwise, validators are not slashed retroactively, only when they are caught. #### Slash Unbonding Delegation diff --git a/x/staking/go.mod b/x/staking/go.mod index 89b56f8f6174..d7ed7cbeea3c 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -40,7 +40,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect @@ -119,7 +121,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -144,14 +146,18 @@ require ( github.com/tidwall/btree v1.7.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/staking/go.sum b/x/staking/go.sum index 81de75ce9a45..ff4eaccb0b25 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -631,8 +633,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw 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/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -793,6 +795,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/staking/keeper/alias_functions.go b/x/staking/keeper/alias_functions.go index 671bc8a7323c..fde1c5254e1e 100644 --- a/x/staking/keeper/alias_functions.go +++ b/x/staking/keeper/alias_functions.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "cosmossdk.io/collections" storetypes "cosmossdk.io/store/types" @@ -56,8 +57,10 @@ func (k Keeper) IterateBondedValidatorsByPower(ctx context.Context, fn func(inde i := int64(0) for ; iterator.Valid() && i < int64(maxValidators); iterator.Next() { address := iterator.Value() - validator := k.mustGetValidator(ctx, address) - + validator, err := k.GetValidator(ctx, address) + if err != nil { + return fmt.Errorf("validator record not found for address: %s", sdk.ValAddress(address).String()) + } if validator.IsBonded() { stop := fn(i, validator) // XXX is this safe will the validator unexposed fields be able to get written to? if stop { diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index f6e6de9f48c1..651cc6310b62 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -212,14 +212,16 @@ func (k Keeper) GetDelegatorUnbonding(ctx context.Context, delegator sdk.AccAddr return unbonding, err } -// GetDelegatorBonded returs the total amount a delegator has bonded. +// GetDelegatorBonded returns the total amount a delegator has bonded. func (k Keeper) GetDelegatorBonded(ctx context.Context, delegator sdk.AccAddress) (math.Int, error) { bonded := math.LegacyZeroDec() + var iterErr error err := k.IterateDelegatorDelegations(ctx, delegator, func(delegation types.Delegation) bool { validatorAddr, err := k.validatorAddressCodec.StringToBytes(delegation.ValidatorAddress) if err != nil { - panic(err) // shouldn't happen + iterErr = err + return true } validator, err := k.GetValidator(ctx, validatorAddr) if err == nil { @@ -229,6 +231,9 @@ func (k Keeper) GetDelegatorBonded(ctx context.Context, delegator sdk.AccAddress } return false }) + if iterErr != nil { + return bonded.RoundInt(), iterErr + } return bonded.RoundInt(), err } @@ -459,16 +464,16 @@ func (k Keeper) GetRedelegationsFromSrcValidator(ctx context.Context, valAddr sd // HasReceivingRedelegation checks if validator is receiving a redelegation. func (k Keeper) HasReceivingRedelegation(ctx context.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) (bool, error) { rng := collections.NewSuperPrefixedTripleRange[[]byte, []byte, []byte](valDstAddr, delAddr) - hasAtleastOneEntry := false + hasReceivingRedelegation := false err := k.RedelegationsByValDst.Walk(ctx, rng, func(key collections.Triple[[]byte, []byte, []byte], value []byte) (stop bool, err error) { - hasAtleastOneEntry = true + hasReceivingRedelegation = true return true, nil // returning true here to stop the iterations after 1st finding }) if err != nil { return false, err } - return hasAtleastOneEntry, nil + return hasReceivingRedelegation, nil } // HasMaxRedelegationEntries checks if the redelegation entries reached maximum limit. @@ -717,7 +722,7 @@ func (k Keeper) Delegate( // all non bonded if subtractAccount { if tokenSrc == types.Bonded { - panic("delegation token source cannot be bonded") + return math.LegacyZeroDec(), fmt.Errorf("delegation token source cannot be bonded; expected Unbonded or Unbonding, got Bonded") } var sendName string @@ -728,7 +733,7 @@ func (k Keeper) Delegate( case validator.IsUnbonding(), validator.IsUnbonded(): sendName = types.NotBondedPoolName default: - panic("invalid validator status") + return math.LegacyZeroDec(), fmt.Errorf("invalid validator status: %v", validator.Status) } bondDenom, err := k.BondDenom(ctx) @@ -760,7 +765,7 @@ func (k Keeper) Delegate( return math.LegacyDec{}, err } default: - panic("unknown token source bond status") + return math.LegacyZeroDec(), fmt.Errorf("unknown token source bond status: %v", tokenSrc) } } @@ -832,9 +837,12 @@ func (k Keeper) Unbond( validator.TokensFromShares(delegation.Shares).TruncateInt().LT(validator.MinSelfDelegation) { err = k.jailValidator(ctx, validator) if err != nil { - return amount, err + return amount, fmt.Errorf("failed to jail validator: %v", err) + } + validator, err = k.GetValidator(ctx, valbz) + if err != nil { + return amount, fmt.Errorf("validator record not found for address: %X", valbz) } - validator = k.mustGetValidator(ctx, valbz) } if delegation.Shares.IsZero() { @@ -906,7 +914,7 @@ func (k Keeper) getBeginInfo( return validator.UnbondingTime, validator.UnbondingHeight, false, nil default: - panic(fmt.Sprintf("unknown validator status: %s", validator.Status)) + return completionTime, height, false, fmt.Errorf("unknown validator status: %v", validator.Status) } } diff --git a/x/staking/keeper/keeper_test.go b/x/staking/keeper/keeper_test.go index d1bbe681b131..b13404cabc69 100644 --- a/x/staking/keeper/keeper_test.go +++ b/x/staking/keeper/keeper_test.go @@ -356,7 +356,7 @@ func (s *KeeperTestSuite) TestUnbondingDelegationsMigrationToColls() { }, }, } - bz := stakingtypes.MustMarshalUBD(s.cdc, ubd) + bz := s.cdc.MustMarshal(&ubd) s.ctx.KVStore(s.key).Set(getUBDKey(delAddrs[i], valAddrs[i]), bz) s.ctx.KVStore(s.key).Set(getUBDByValIndexKey(delAddrs[i], valAddrs[i]), []byte{}) }, @@ -444,7 +444,7 @@ func (s *KeeperTestSuite) TestValidatorsMigrationToColls() { Commission: stakingtypes.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), MinSelfDelegation: math.ZeroInt(), } - valBz := stakingtypes.MustMarshalValidator(s.cdc, &val) + valBz := s.cdc.MustMarshal(&val) // legacy Set method s.ctx.KVStore(s.key).Set(getValidatorKey(valAddrs[i]), valBz) }, diff --git a/x/staking/keeper/slash.go b/x/staking/keeper/slash.go index d6be7b93f0c5..17d07a8da57a 100644 --- a/x/staking/keeper/slash.go +++ b/x/staking/keeper/slash.go @@ -57,7 +57,7 @@ func (k Keeper) Slash(ctx context.Context, consAddr sdk.ConsAddress, infractionH // Log the slash attempt for future reference (maybe we should tag it too) conStr, err := k.consensusAddressCodec.BytesToString(consAddr) if err != nil { - panic(err) + return math.NewInt(0), err } logger.Error( @@ -191,7 +191,7 @@ func (k Keeper) Slash(ctx context.Context, consAddr sdk.ConsAddress, infractionH return math.NewInt(0), err } default: - panic("invalid validator status") + return math.NewInt(0), fmt.Errorf("invalid validator status") } logger.Info( @@ -210,7 +210,10 @@ func (k Keeper) SlashWithInfractionReason(ctx context.Context, consAddr sdk.Cons // jail a validator func (k Keeper) Jail(ctx context.Context, consAddr sdk.ConsAddress) error { - validator := k.mustGetValidatorByConsAddr(ctx, consAddr) + validator, err := k.GetValidatorByConsAddr(ctx, consAddr) + if err != nil { + return fmt.Errorf("validator with consensus-Address %s not found", consAddr) + } if err := k.jailValidator(ctx, validator); err != nil { return err } @@ -222,7 +225,10 @@ func (k Keeper) Jail(ctx context.Context, consAddr sdk.ConsAddress) error { // unjail a validator func (k Keeper) Unjail(ctx context.Context, consAddr sdk.ConsAddress) error { - validator := k.mustGetValidatorByConsAddr(ctx, consAddr) + validator, err := k.GetValidatorByConsAddr(ctx, consAddr) + if err != nil { + return fmt.Errorf("validator with consensus-Address %s not found", consAddr) + } if err := k.unjailValidator(ctx, validator); err != nil { return err } @@ -356,14 +362,14 @@ func (k Keeper) SlashRedelegation(ctx context.Context, srcValidator types.Valida } // tokens of a redelegation currently live in the destination validator - // therefor we must burn tokens from the destination-validator's bonding status + // therefore we must burn tokens from the destination-validator's bonding status switch { case dstValidator.IsBonded(): bondedBurnedAmount = bondedBurnedAmount.Add(tokensToBurn) case dstValidator.IsUnbonded() || dstValidator.IsUnbonding(): notBondedBurnedAmount = notBondedBurnedAmount.Add(tokensToBurn) default: - panic("unknown validator status") + return math.ZeroInt(), fmt.Errorf("unknown validator status") } } diff --git a/x/staking/keeper/val_state_change.go b/x/staking/keeper/val_state_change.go index 73675b3d4c5c..3d09937c1ef4 100644 --- a/x/staking/keeper/val_state_change.go +++ b/x/staking/keeper/val_state_change.go @@ -156,10 +156,13 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates // everything that is iterated in this loop is becoming or already a // part of the bonded validator set valAddr := sdk.ValAddress(iterator.Value()) - validator := k.mustGetValidator(ctx, valAddr) + validator, err := k.GetValidator(ctx, valAddr) + if err != nil { + return nil, fmt.Errorf("validator record not found for address: %X", valAddr) + } if validator.Jailed { - panic("should never retrieve a jailed validator from the power store") + return nil, fmt.Errorf("should never retrieve a jailed validator from the power store") } // if we get to a zero-power validator (which we don't bond), @@ -185,7 +188,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates case validator.IsBonded(): // no state change default: - panic("unexpected validator status") + return nil, fmt.Errorf("unexpected validator status") } // fetch the old power bytes @@ -218,7 +221,10 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates } for _, valAddrBytes := range noLongerBonded { - validator := k.mustGetValidator(ctx, sdk.ValAddress(valAddrBytes)) + validator, err := k.GetValidator(ctx, sdk.ValAddress(valAddrBytes)) + if err != nil { + return nil, fmt.Errorf("validator record not found for address: %X", sdk.ValAddress(valAddrBytes)) + } validator, err = k.bondedToUnbonding(ctx, validator) if err != nil { return nil, err @@ -274,7 +280,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates func (k Keeper) bondedToUnbonding(ctx context.Context, validator types.Validator) (types.Validator, error) { if !validator.IsBonded() { - panic(fmt.Sprintf("bad state transition bondedToUnbonding, validator: %v\n", validator)) + return types.Validator{}, fmt.Errorf("bad state transition bondedToUnbonding, validator: %v", validator) } return k.BeginUnbondingValidator(ctx, validator) @@ -282,7 +288,7 @@ func (k Keeper) bondedToUnbonding(ctx context.Context, validator types.Validator func (k Keeper) unbondingToBonded(ctx context.Context, validator types.Validator) (types.Validator, error) { if !validator.IsUnbonding() { - panic(fmt.Sprintf("bad state transition unbondingToBonded, validator: %v\n", validator)) + return types.Validator{}, fmt.Errorf("bad state transition unbondingToBonded, validator: %v", validator) } return k.bondValidator(ctx, validator) @@ -290,7 +296,7 @@ func (k Keeper) unbondingToBonded(ctx context.Context, validator types.Validator func (k Keeper) unbondedToBonded(ctx context.Context, validator types.Validator) (types.Validator, error) { if !validator.IsUnbonded() { - panic(fmt.Sprintf("bad state transition unbondedToBonded, validator: %v\n", validator)) + return types.Validator{}, fmt.Errorf("bad state transition unbondedToBonded, validator: %v", validator) } return k.bondValidator(ctx, validator) @@ -388,7 +394,7 @@ func (k Keeper) BeginUnbondingValidator(ctx context.Context, validator types.Val // sanity check if validator.Status != types.Bonded { - panic(fmt.Sprintf("should not already be unbonded or unbonding, validator: %v\n", validator)) + return validator, fmt.Errorf("should not already be unbonded or unbonding, validator: %v", validator) } id, err := k.IncrementUnbondingID(ctx) diff --git a/x/staking/keeper/validator.go b/x/staking/keeper/validator.go index 6b6eef790975..b95dd87a7742 100644 --- a/x/staking/keeper/validator.go +++ b/x/staking/keeper/validator.go @@ -34,15 +34,6 @@ func (k Keeper) GetValidator(ctx context.Context, addr sdk.ValAddress) (validato return validator, nil } -func (k Keeper) mustGetValidator(ctx context.Context, addr sdk.ValAddress) types.Validator { - validator, err := k.GetValidator(ctx, addr) - if err != nil { - panic(fmt.Sprintf("validator record not found for address: %X\n", addr)) - } - - return validator -} - // GetValidatorByConsAddr gets a single validator by consensus address func (k Keeper) GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (validator types.Validator, err error) { opAddr, err := k.ValidatorByConsensusAddress.Get(ctx, consAddr) @@ -57,15 +48,6 @@ func (k Keeper) GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAdd return k.GetValidator(ctx, opAddr) } -func (k Keeper) mustGetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) types.Validator { - validator, err := k.GetValidatorByConsAddr(ctx, consAddr) - if err != nil { - panic(fmt.Errorf("validator with consensus-Address %s not found", consAddr)) - } - - return validator -} - // SetValidator sets the main record holding validator details func (k Keeper) SetValidator(ctx context.Context, validator types.Validator) error { valBz, err := k.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) @@ -317,7 +299,10 @@ func (k Keeper) GetBondedValidatorsByPower(ctx context.Context) ([]types.Validat i := 0 for ; iterator.Valid() && i < int(maxValidators); iterator.Next() { address := iterator.Value() - validator := k.mustGetValidator(ctx, address) + validator, err := k.GetValidator(ctx, address) + if err != nil { + return nil, fmt.Errorf("validator record not found for address: %X", address) + } if validator.IsBonded() { validators[i] = validator @@ -383,7 +368,7 @@ func (k Keeper) GetLastValidators(ctx context.Context) (validators []types.Valid err = k.LastValidatorPower.Walk(ctx, nil, func(key []byte, _ gogotypes.Int64Value) (bool, error) { // sanity check if i >= int(maxValidators) { - panic("more validators than maxValidators found") + return true, fmt.Errorf("more validators than maxValidators found") } validator, err := k.GetValidator(ctx, key) diff --git a/x/staking/types/authz.go b/x/staking/types/authz.go index cacf5e225dbb..d3c7425d6ade 100644 --- a/x/staking/types/authz.go +++ b/x/staking/types/authz.go @@ -164,14 +164,24 @@ func validateAllowAndDenyValidators(allowed, denied []sdk.ValAddress) ([]string, allowedValidators := make([]string, len(allowed)) if len(allowed) > 0 { + foundAllowedValidators := make(map[string]bool, len(allowed)) for i, validator := range allowed { + if foundAllowedValidators[validator.String()] { + return nil, nil, sdkerrors.ErrInvalidRequest.Wrapf("duplicate allowed validator address: %s", validator.String()) + } + foundAllowedValidators[validator.String()] = true allowedValidators[i] = validator.String() } return allowedValidators, nil, nil } deniedValidators := make([]string, len(denied)) + foundDeniedValidators := make(map[string]bool, len(denied)) for i, validator := range denied { + if foundDeniedValidators[validator.String()] { + return nil, nil, sdkerrors.ErrInvalidRequest.Wrapf("duplicate denied validator address: %s", validator.String()) + } + foundDeniedValidators[validator.String()] = true deniedValidators[i] = validator.String() } diff --git a/x/staking/types/authz_test.go b/x/staking/types/authz_test.go index 8ef9a9b3868e..fa6185293ec5 100644 --- a/x/staking/types/authz_test.go +++ b/x/staking/types/authz_test.go @@ -42,6 +42,14 @@ func TestAuthzAuthorizations(t *testing.T) { _, err = stakingtypes.NewStakeAuthorization([]sdk.ValAddress{val1, val2}, []sdk.ValAddress{val1}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, &coin100) require.Error(t, err) + // error duplicate allow list + _, err = stakingtypes.NewStakeAuthorization([]sdk.ValAddress{val1, val1}, []sdk.ValAddress{}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, &coin100) + require.ErrorContains(t, err, "duplicate allowed validator address") + + // error duplicate denied list + _, err = stakingtypes.NewStakeAuthorization([]sdk.ValAddress{}, []sdk.ValAddress{val1, val1}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, &coin100) + require.ErrorContains(t, err, "duplicate denied validator address") + // verify MethodName undelAuth, _ := stakingtypes.NewStakeAuthorization([]sdk.ValAddress{val1, val2}, []sdk.ValAddress{}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_UNDELEGATE, &coin100) require.Equal(t, undelAuth.MsgTypeURL(), sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{})) diff --git a/x/staking/types/staking.pb.go b/x/staking/types/staking.pb.go index 58148c020649..51d148a4f59e 100644 --- a/x/staking/types/staking.pb.go +++ b/x/staking/types/staking.pb.go @@ -439,7 +439,7 @@ type Validator struct { MinSelfDelegation cosmossdk_io_math.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=cosmossdk.io/math.Int" json:"min_self_delegation"` // strictly positive if this validator's unbonding has been stopped by external modules UnbondingOnHoldRefCount int64 `protobuf:"varint,12,opt,name=unbonding_on_hold_ref_count,json=unbondingOnHoldRefCount,proto3" json:"unbonding_on_hold_ref_count,omitempty"` - // list of unbonding ids, each uniquely identifing an unbonding of this validator + // list of unbonding ids, each uniquely identifying an unbonding of this validator UnbondingIds []uint64 `protobuf:"varint,13,rep,packed,name=unbonding_ids,json=unbondingIds,proto3" json:"unbonding_ids,omitempty"` } @@ -1329,7 +1329,7 @@ type ConsPubKeyRotationHistory struct { OldConsPubkey *types1.Any `protobuf:"bytes,2,opt,name=old_cons_pubkey,json=oldConsPubkey,proto3" json:"old_cons_pubkey,omitempty"` // new_cons_pubkey is the new consensus public key of the validator, as a Protobuf Any. NewConsPubkey *types1.Any `protobuf:"bytes,3,opt,name=new_cons_pubkey,json=newConsPubkey,proto3" json:"new_cons_pubkey,omitempty"` - // height defines the block height at which the rotation event occured. + // height defines the block height at which the rotation event occurred. Height uint64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` // fee holds the amount of fee deduced for the rotation. Fee types2.Coin `protobuf:"bytes,5,opt,name=fee,proto3" json:"fee"` diff --git a/x/upgrade/CHANGELOG.md b/x/upgrade/CHANGELOG.md index d807decc0b71..5cd6aa136cc4 100644 --- a/x/upgrade/CHANGELOG.md +++ b/x/upgrade/CHANGELOG.md @@ -25,6 +25,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v0.1.1](https://github.com/cosmos/cosmos-sdk/releases/tag/x/upgrade/v0.1.1) - 2023-12-11 + ### Improvements * [#18470](https://github.com/cosmos/cosmos-sdk/pull/18470) Improve go-getter settings. diff --git a/x/upgrade/README.md b/x/upgrade/README.md index 0d98c1601e50..974d76c9e28d 100644 --- a/x/upgrade/README.md +++ b/x/upgrade/README.md @@ -91,7 +91,7 @@ If there's a planned upgrade and the upgrade height is reached, the old binary w This information is critical to ensure the `StoreUpgrades` happens smoothly at correct height and expected upgrade. It eliminiates the chances for the new binary to execute `StoreUpgrades` multiple -times everytime on restart. Also if there are multiple upgrades planned on same height, the `Name` +times every time on restart. Also if there are multiple upgrades planned on same height, the `Name` will ensure these `StoreUpgrades` takes place only in planned upgrade handler. ### Proposal diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 225aef57053e..fb47a062baaa 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -44,7 +44,9 @@ require ( 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/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -135,7 +137,7 @@ require ( 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/pelletier/go-toml/v2 v2.1.1 // indirect github.com/petermattis/goid v0.0.0-20231126143041-f558c26febf5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -160,17 +162,21 @@ require ( 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 + gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect + gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // 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.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 07c0b31dd5fd..e83eeaef077e 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -217,6 +217,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 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/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+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= @@ -858,8 +860,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/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-20231126143041-f558c26febf5 h1:+qIP3OMrT7SN5kLnTcVEISPOMB/97RyAKTg1UWA738E= @@ -1026,6 +1028,10 @@ 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= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA= +gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q= +gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02/go.mod h1:JTnUj0mpYiAsuZLmKjTx/ex3AtMowcCgnE7YNyCEP0I= 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= diff --git a/x/upgrade/internal/conv/doc.go b/x/upgrade/internal/conv/doc.go index 1c86f5c14409..4b45d1ab53f9 100644 --- a/x/upgrade/internal/conv/doc.go +++ b/x/upgrade/internal/conv/doc.go @@ -1,2 +1,2 @@ -// Package conv provides internal functions for convertions and data manipulation +// Package conv provides internal functions for conversions and data manipulation package conv diff --git a/x/upgrade/plan/info.go b/x/upgrade/plan/info.go index 79e2c0286205..d05c985b5419 100644 --- a/x/upgrade/plan/info.go +++ b/x/upgrade/plan/info.go @@ -20,7 +20,7 @@ type Info struct { Binaries BinaryDownloadURLMap `json:"binaries"` } -// BinaryDownloadURLMap is a map of os/architecture stings to a URL where the binary can be downloaded. +// BinaryDownloadURLMap is a map of os/architecture strings to a URL where the binary can be downloaded. type BinaryDownloadURLMap map[string]string // ParseConfig is used to configure the parsing of a Plan.Info string.