From 8d8baa267ce92654e37989c778f4065e1392b394 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Sun, 26 May 2024 14:51:44 -0500 Subject: [PATCH] feat: cosmos-sdk 47 Signed-off-by: Artur Troian --- .goreleaser-docker.yaml | 2 + .goreleaser.yaml | 1 + README.md | 2 +- _docs/adr/adr-001-network-upgrades.md | 2 +- app/ante.go | 46 +- app/app.go | 647 ++++------ app/app_configure.go | 427 +++---- app/app_test.go | 6 +- app/config.go | 107 +- app/decorators/gov_filter.go | 92 -- app/decorators/min_commision.go | 14 +- app/export.go | 31 +- app/lanes.go | 80 ++ app/mac.go | 10 +- app/modules.go | 349 ++++++ app/params/encoding.go | 16 + app/params/proto.go | 7 +- app/sim_test.go | 610 +++++----- app/types/app.go | 542 ++++++++- app/upgrades.go | 25 +- client/client.go | 20 +- cmd/akash/cmd/bech32.go | 2 +- cmd/akash/cmd/flag_test.go | 8 +- cmd/akash/cmd/root.go | 73 +- cmd/akash/cmd/testnetify/cmd.go | 10 +- cmd/akash/cmd/testnetify/escrow.go | 2 +- cmd/akash/cmd/testnetify/state.go | 80 +- cmd/akash/cmd/testnetify/util.go | 11 +- cmd/akash/main.go | 4 +- cmd/common/flags.go | 7 +- events/cmd/root.go | 27 +- events/publish.go | 116 +- events/publish_test.go | 96 +- events/query.go | 6 +- go.mod | 201 +-- go.sum | 1079 +++++++++++++---- pubsub/bus_test.go | 4 +- script/tools.sh | 77 ++ sdl/_testdata/deployment-svc-mismatch.yaml | 45 - sdl/_testdata/private_service.yaml | 64 - sdl/_testdata/profile-svc-name-mismatch.yaml | 38 - sdl/_testdata/service-mix.yaml | 80 -- sdl/_testdata/service-mix2.yaml | 69 -- sdl/_testdata/simple-double-ram.yaml | 45 - sdl/_testdata/simple-gpu.yaml | 52 - sdl/_testdata/simple-with-ip.yaml | 50 - sdl/_testdata/simple.yaml | 45 - sdl/_testdata/simple2.yaml | 64 - sdl/_testdata/simple3.yaml | 45 - sdl/_testdata/simple4.yaml | 90 -- sdl/_testdata/storageClass1.yaml | 52 - sdl/_testdata/storageClass2.yaml | 53 - sdl/_testdata/storageClass3.yaml | 52 - sdl/_testdata/storageClass4.yaml | 59 - sdl/_testdata/storageClass5.yaml | 51 - sdl/_testdata/storageClass6.yaml | 53 - sdl/_testdata/v2.1-credentials-error.yaml | 48 - sdl/_testdata/v2.1-credentials.yaml | 49 - .../v2.1-deployment-svc-mismatch.yaml | 45 - sdl/_testdata/v2.1-private_service.yaml | 64 - .../v2.1-profile-svc-name-mismatch.yaml | 38 - sdl/_testdata/v2.1-service-mix.yaml | 80 -- sdl/_testdata/v2.1-service-mix2.yaml | 69 -- sdl/_testdata/v2.1-simple-gpu.yaml | 52 - sdl/_testdata/v2.1-simple-with-ip.yaml | 50 - sdl/_testdata/v2.1-simple.yaml | 45 - sdl/_testdata/v2.1-simple2.yaml | 64 - sdl/_testdata/v2.1-simple3.yaml | 45 - sdl/_testdata/v2.1-simple4.yaml | 90 -- sdl/coin.go | 53 - sdl/coin_test.go | 43 - sdl/cpu.go | 47 - sdl/cpu_test.go | 24 - sdl/expose.go | 114 -- sdl/full_test.go | 66 - sdl/gpu.go | 131 -- sdl/gpu_test.go | 190 --- sdl/groupBuilder_v2.go | 149 --- sdl/groupBuilder_v2_1.go | 160 --- sdl/memory.go | 42 - sdl/placement.go | 37 - sdl/pricing.go | 4 - sdl/resources.go | 59 - sdl/sdl.go | 159 --- sdl/sdl_test.go | 59 - sdl/storage.go | 251 ---- sdl/storage_test.go | 229 ---- sdl/units.go | 154 --- sdl/units_test.go | 99 -- sdl/util/util.go | 31 - sdl/util/util_test.go | 31 - sdl/utils.go | 17 - sdl/v2.go | 582 --------- sdl/v2_1.go | 364 ------ sdl/v2_1_ip_test.go | 279 ----- sdl/v2_1_test.go | 760 ------------ sdl/v2_ip_test.go | 297 ----- sdl/v2_test.go | 940 -------------- tests/upgrade/upgrade_test.go | 8 +- tests/upgrade/v0.26.0/postupgrade.go | 4 +- tests/upgrade/v0.32.0/postupgrade.go | 6 +- tests/upgrade/v0.34.0/postupgrade.go | 10 +- tests/upgrade/v0.36.0/postupgrade.go | 11 +- tests/upgrade/workers_test.go | 8 +- testutil/audit.go | 2 +- testutil/base.go | 23 +- testutil/cert.go | 11 +- testutil/cli/cmd.go | 12 +- testutil/cosmos/keepers.go | 4 +- testutil/cosmos/mocks/authz_keeper.go | 44 +- testutil/deployment.go | 31 +- testutil/event.go | 116 +- testutil/ids.go | 11 +- testutil/log.go | 2 +- testutil/network/network.go | 20 +- testutil/network/util.go | 16 +- testutil/network_suite.go | 4 +- testutil/provider.go | 2 +- testutil/state/suite.go | 57 +- testutil/types.go | 36 +- tools/upgrade-info/main.go | 2 +- upgrades/software/v0.15.0/audit.go | 34 - upgrades/software/v0.15.0/cert.go | 34 - upgrades/software/v0.15.0/deployment.go | 48 - upgrades/software/v0.15.0/escrow.go | 84 -- upgrades/software/v0.15.0/helpers.go | 41 - upgrades/software/v0.15.0/init.go | 25 - upgrades/software/v0.15.0/market.go | 183 --- .../v0.15.0/proto_compatibility_test.go | 290 ----- upgrades/software/v0.15.0/provider.go | 46 - upgrades/software/v0.15.0/upgrade.go | 93 -- upgrades/software/v0.18.0/init.go | 11 - upgrades/software/v0.18.0/upgrade.go | 79 -- upgrades/software/v0.20.0/init.go | 11 - upgrades/software/v0.20.0/upgrade.go | 58 - upgrades/software/v0.24.0/deployment.go | 48 - upgrades/software/v0.24.0/init.go | 17 - upgrades/software/v0.24.0/market.go | 59 - upgrades/software/v0.24.0/upgrade.go | 220 ---- upgrades/software/v0.26.0/init.go | 11 - upgrades/software/v0.26.0/upgrade.go | 206 ---- upgrades/software/v0.28.0/init.go | 14 - upgrades/software/v0.28.0/market.go | 48 - upgrades/software/v0.28.0/upgrade.go | 47 - upgrades/software/v0.30.0/init.go | 11 - upgrades/software/v0.30.0/upgrade.go | 47 - upgrades/software/v0.32.0/init.go | 14 - upgrades/software/v0.32.0/market.go | 39 - upgrades/software/v0.32.0/upgrade.go | 47 - upgrades/software/v0.34.0/init.go | 2 +- upgrades/software/v0.34.0/upgrade.go | 6 +- upgrades/software/v0.36.0/init.go | 2 +- upgrades/software/v0.36.0/upgrade.go | 4 +- upgrades/types/types.go | 10 +- upgrades/upgrades.go | 18 +- upgrades/upgrades_test.go | 2 +- util/cli/configs.go | 6 +- util/cli/upgrade_info.go | 12 +- util/metrics/metrics.go | 2 +- util/partialord/internal/dag/dag.go | 320 +++++ util/partialord/internal/dag/dag_test.go | 154 +++ util/partialord/internal/dag/module.go | 9 + util/partialord/module.go | 2 + util/partialord/partialord.go | 97 ++ util/partialord/partialord_test.go | 74 ++ util/server/server.go | 54 +- util/wsutil/wsutil.go | 3 +- util/wsutil/wsutil_test.go | 5 +- x/audit/alias.go | 4 +- x/audit/client/cli/query.go | 4 +- x/audit/client/cli/tx.go | 19 +- x/audit/client/rest/rest.go | 87 -- x/audit/genesis.go | 6 +- x/audit/handler/handler.go | 4 +- x/audit/handler/handler_test.go | 19 +- x/audit/handler/msg_server.go | 4 +- x/audit/keeper/grpc_query.go | 7 +- x/audit/keeper/grpc_query_test.go | 8 +- x/audit/keeper/keeper.go | 48 +- x/audit/keeper/keeper_test.go | 19 +- x/audit/keeper/key.go | 5 +- x/audit/module.go | 109 +- x/audit/query/rawclient.go | 2 +- x/cert/alias.go | 4 +- x/cert/client/cli/grpc_rest_test.go | 12 +- x/cert/client/cli/query.go | 11 +- x/cert/client/cli/test_helpers.go | 2 +- x/cert/client/cli/tx.go | 18 +- x/cert/client/cli/tx_cmd.go | 3 +- x/cert/client/cli/tx_test.go | 6 +- x/cert/genesis.go | 6 +- x/cert/handler/handler.go | 6 +- x/cert/handler/handler_test.go | 22 +- x/cert/handler/msg_server.go | 4 +- x/cert/keeper/grpc_query.go | 20 +- x/cert/keeper/grpc_query_test.go | 10 +- x/cert/keeper/keeper.go | 19 +- x/cert/keeper/keeper_test.go | 17 +- x/cert/keeper/key.go | 2 +- x/cert/module.go | 84 +- x/cert/simulation/genesis.go | 2 +- x/cert/utils/key_pair_manager.go | 5 +- x/cert/utils/utils.go | 4 +- x/deployment/alias.go | 4 +- x/deployment/client/cli/cli_test.go | 235 ++-- x/deployment/client/cli/flags.go | 26 +- x/deployment/client/cli/grpc_rest_test.go | 108 +- x/deployment/client/cli/query.go | 27 +- x/deployment/client/cli/test_helpers.go | 16 +- x/deployment/client/cli/tx.go | 61 +- x/deployment/client/cli/util.go | 20 - x/deployment/client/rest/params.go | 47 +- x/deployment/client/rest/rest.go | 132 +- x/deployment/genesis.go | 39 +- x/deployment/handler/handler.go | 7 +- x/deployment/handler/handler_test.go | 190 ++- x/deployment/handler/keepers.go | 16 +- x/deployment/handler/mocks/authz_keeper.go | 46 +- x/deployment/handler/server.go | 87 +- x/deployment/keeper/external.go | 2 +- x/deployment/keeper/grpc_query.go | 19 +- x/deployment/keeper/grpc_query_test.go | 134 +- x/deployment/keeper/keeper.go | 186 +-- x/deployment/keeper/keeper_test.go | 78 +- x/deployment/keeper/key.go | 21 +- x/deployment/module.go | 98 +- x/deployment/query/client.go | 2 +- x/deployment/query/path.go | 2 +- x/deployment/query/rawclient.go | 2 +- x/deployment/query/types.go | 22 +- x/deployment/simulation/genesis.go | 5 +- x/deployment/simulation/operations.go | 783 ++++++------ x/escrow/alias.go | 2 +- x/escrow/client/cli/query.go | 39 +- x/escrow/client/rest/rest.go | 2 +- x/escrow/genesis.go | 6 +- x/escrow/keeper/external.go | 4 +- x/escrow/keeper/keeper.go | 218 ++-- x/escrow/keeper/keeper_settle_test.go | 12 +- x/escrow/keeper/keeper_test.go | 46 +- x/escrow/keeper/key.go | 14 +- x/escrow/keeper/querier.go | 4 +- x/escrow/module.go | 126 +- x/escrow/query/querier.go | 20 +- x/gov/alias.go | 4 +- x/gov/genesis.go | 6 +- x/gov/keeper/keeper.go | 2 +- x/gov/module.go | 10 +- x/gov/simulation/genesis.go | 2 +- x/gov/simulation/operations.go | 2 +- x/inflation/alias.go | 4 +- x/inflation/genesis.go | 6 +- x/inflation/keeper/keeper.go | 2 +- x/inflation/module.go | 10 +- x/inflation/simulation/genesis.go | 2 +- x/market/alias.go | 4 +- x/market/client/cli/bid.go | 23 +- x/market/client/cli/cli_test.go | 117 +- x/market/client/cli/flags.go | 210 ---- x/market/client/cli/grpc_rest_test.go | 258 ++-- x/market/client/cli/lease.go | 28 +- x/market/client/cli/order.go | 27 +- x/market/client/cli/query.go | 4 +- x/market/client/cli/test_helpers.go | 5 +- x/market/client/cli/tx.go | 67 +- x/market/client/rest/params.go | 63 +- x/market/client/rest/rest.go | 3 +- x/market/genesis.go | 37 +- x/market/handler/handler.go | 2 +- x/market/handler/handler_test.go | 86 +- x/market/handler/keepers.go | 15 +- x/market/handler/server.go | 97 +- x/market/hooks/external.go | 28 +- x/market/hooks/hooks.go | 27 +- x/market/keeper/external.go | 10 +- x/market/keeper/grpc_query.go | 33 +- x/market/keeper/grpc_query_test.go | 204 ++-- x/market/keeper/keeper.go | 292 +++-- x/market/keeper/keeper_test.go | 97 +- x/market/keeper/keys/{v1beta4 => }/key.go | 27 +- .../keeper/keys/{v1beta4 => }/key_test.go | 17 +- x/market/keeper/keys/v1beta1/key.go | 92 -- x/market/keeper/keys/v1beta2/key.go | 164 --- x/market/keeper/keys/v1beta2/key_test.go | 34 - x/market/keeper/keys/v1beta3/key.go | 164 --- x/market/keeper/keys/v1beta3/key_test.go | 34 - x/market/module.go | 108 +- x/market/query/client.go | 2 +- x/market/query/path.go | 39 +- x/market/query/rawclient.go | 15 +- x/market/query/types.go | 2 +- x/market/simulation/genesis.go | 4 +- x/market/simulation/operations.go | 13 +- x/market/simulation/utils.go | 6 +- x/provider/alias.go | 4 +- x/provider/client/cli/cli_test.go | 30 +- x/provider/client/cli/grpc_rest_test.go | 22 +- x/provider/client/cli/query.go | 7 +- x/provider/client/cli/test_helpers.go | 2 +- x/provider/client/cli/tx.go | 12 +- x/provider/client/rest/rest.go | 5 +- x/provider/config/config.go | 13 +- x/provider/genesis.go | 6 +- x/provider/handler/handler.go | 8 +- x/provider/handler/handler_test.go | 47 +- x/provider/handler/server.go | 19 +- x/provider/keeper/grpc_query.go | 2 +- x/provider/keeper/grpc_query_test.go | 10 +- x/provider/keeper/keeper.go | 37 +- x/provider/keeper/keeper_test.go | 8 +- x/provider/module.go | 102 +- x/provider/query/types.go | 2 +- x/provider/simulation/genesis.go | 2 +- x/provider/simulation/operations.go | 12 +- x/staking/alias.go | 4 +- x/staking/genesis.go | 6 +- x/staking/keeper/keeper.go | 11 +- x/staking/module.go | 10 +- x/staking/simulation/genesis.go | 2 +- x/staking/simulation/operations.go | 2 +- x/take/alias.go | 2 +- x/take/genesis.go | 6 +- x/take/keeper/keeper.go | 12 +- x/take/module.go | 82 +- x/take/simulation/genesis.go | 3 +- 325 files changed, 6856 insertions(+), 14695 deletions(-) delete mode 100644 app/decorators/gov_filter.go create mode 100644 app/lanes.go create mode 100644 app/modules.go create mode 100644 app/params/encoding.go delete mode 100644 sdl/_testdata/deployment-svc-mismatch.yaml delete mode 100644 sdl/_testdata/private_service.yaml delete mode 100644 sdl/_testdata/profile-svc-name-mismatch.yaml delete mode 100644 sdl/_testdata/service-mix.yaml delete mode 100644 sdl/_testdata/service-mix2.yaml delete mode 100644 sdl/_testdata/simple-double-ram.yaml delete mode 100644 sdl/_testdata/simple-gpu.yaml delete mode 100644 sdl/_testdata/simple-with-ip.yaml delete mode 100644 sdl/_testdata/simple.yaml delete mode 100644 sdl/_testdata/simple2.yaml delete mode 100644 sdl/_testdata/simple3.yaml delete mode 100644 sdl/_testdata/simple4.yaml delete mode 100644 sdl/_testdata/storageClass1.yaml delete mode 100644 sdl/_testdata/storageClass2.yaml delete mode 100644 sdl/_testdata/storageClass3.yaml delete mode 100644 sdl/_testdata/storageClass4.yaml delete mode 100644 sdl/_testdata/storageClass5.yaml delete mode 100644 sdl/_testdata/storageClass6.yaml delete mode 100644 sdl/_testdata/v2.1-credentials-error.yaml delete mode 100644 sdl/_testdata/v2.1-credentials.yaml delete mode 100644 sdl/_testdata/v2.1-deployment-svc-mismatch.yaml delete mode 100644 sdl/_testdata/v2.1-private_service.yaml delete mode 100644 sdl/_testdata/v2.1-profile-svc-name-mismatch.yaml delete mode 100644 sdl/_testdata/v2.1-service-mix.yaml delete mode 100644 sdl/_testdata/v2.1-service-mix2.yaml delete mode 100644 sdl/_testdata/v2.1-simple-gpu.yaml delete mode 100644 sdl/_testdata/v2.1-simple-with-ip.yaml delete mode 100644 sdl/_testdata/v2.1-simple.yaml delete mode 100644 sdl/_testdata/v2.1-simple2.yaml delete mode 100644 sdl/_testdata/v2.1-simple3.yaml delete mode 100644 sdl/_testdata/v2.1-simple4.yaml delete mode 100644 sdl/coin.go delete mode 100644 sdl/coin_test.go delete mode 100644 sdl/cpu.go delete mode 100644 sdl/cpu_test.go delete mode 100644 sdl/expose.go delete mode 100644 sdl/full_test.go delete mode 100644 sdl/gpu.go delete mode 100644 sdl/gpu_test.go delete mode 100644 sdl/groupBuilder_v2.go delete mode 100644 sdl/groupBuilder_v2_1.go delete mode 100644 sdl/memory.go delete mode 100644 sdl/placement.go delete mode 100644 sdl/pricing.go delete mode 100644 sdl/resources.go delete mode 100644 sdl/sdl.go delete mode 100644 sdl/sdl_test.go delete mode 100644 sdl/storage.go delete mode 100644 sdl/storage_test.go delete mode 100644 sdl/units.go delete mode 100644 sdl/units_test.go delete mode 100644 sdl/util/util.go delete mode 100644 sdl/util/util_test.go delete mode 100644 sdl/utils.go delete mode 100644 sdl/v2.go delete mode 100644 sdl/v2_1.go delete mode 100644 sdl/v2_1_ip_test.go delete mode 100644 sdl/v2_1_test.go delete mode 100644 sdl/v2_ip_test.go delete mode 100644 sdl/v2_test.go delete mode 100644 upgrades/software/v0.15.0/audit.go delete mode 100644 upgrades/software/v0.15.0/cert.go delete mode 100644 upgrades/software/v0.15.0/deployment.go delete mode 100644 upgrades/software/v0.15.0/escrow.go delete mode 100644 upgrades/software/v0.15.0/helpers.go delete mode 100644 upgrades/software/v0.15.0/init.go delete mode 100644 upgrades/software/v0.15.0/market.go delete mode 100644 upgrades/software/v0.15.0/proto_compatibility_test.go delete mode 100644 upgrades/software/v0.15.0/provider.go delete mode 100644 upgrades/software/v0.15.0/upgrade.go delete mode 100644 upgrades/software/v0.18.0/init.go delete mode 100644 upgrades/software/v0.18.0/upgrade.go delete mode 100644 upgrades/software/v0.20.0/init.go delete mode 100644 upgrades/software/v0.20.0/upgrade.go delete mode 100644 upgrades/software/v0.24.0/deployment.go delete mode 100644 upgrades/software/v0.24.0/init.go delete mode 100644 upgrades/software/v0.24.0/market.go delete mode 100644 upgrades/software/v0.24.0/upgrade.go delete mode 100644 upgrades/software/v0.26.0/init.go delete mode 100644 upgrades/software/v0.26.0/upgrade.go delete mode 100644 upgrades/software/v0.28.0/init.go delete mode 100644 upgrades/software/v0.28.0/market.go delete mode 100644 upgrades/software/v0.28.0/upgrade.go delete mode 100644 upgrades/software/v0.30.0/init.go delete mode 100644 upgrades/software/v0.30.0/upgrade.go delete mode 100644 upgrades/software/v0.32.0/init.go delete mode 100644 upgrades/software/v0.32.0/market.go delete mode 100644 upgrades/software/v0.32.0/upgrade.go create mode 100644 util/partialord/internal/dag/dag.go create mode 100644 util/partialord/internal/dag/dag_test.go create mode 100644 util/partialord/internal/dag/module.go create mode 100644 util/partialord/module.go create mode 100644 util/partialord/partialord.go create mode 100644 util/partialord/partialord_test.go delete mode 100644 x/audit/client/rest/rest.go delete mode 100644 x/deployment/client/cli/util.go delete mode 100644 x/market/client/cli/flags.go rename x/market/keeper/keys/{v1beta4 => }/key.go (84%) rename x/market/keeper/keys/{v1beta4 => }/key_test.go (59%) delete mode 100644 x/market/keeper/keys/v1beta1/key.go delete mode 100644 x/market/keeper/keys/v1beta2/key.go delete mode 100644 x/market/keeper/keys/v1beta2/key_test.go delete mode 100644 x/market/keeper/keys/v1beta3/key.go delete mode 100644 x/market/keeper/keys/v1beta3/key_test.go diff --git a/.goreleaser-docker.yaml b/.goreleaser-docker.yaml index ec0f5068c3..60f71a53d5 100644 --- a/.goreleaser-docker.yaml +++ b/.goreleaser-docker.yaml @@ -1,4 +1,6 @@ +--- project_name: node +dist: ./.cache/goreleaser-docker env: - GO111MODULE=on - CGO_ENABLED=1 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 3640d8d61d..d80e7feeab 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,3 +1,4 @@ +--- project_name: node dist: ./.cache/goreleaser env: diff --git a/README.md b/README.md index 59c03aa7b2..0fa7542c13 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The `main` branch contains new features and is under active development; the `ma Akash Suite is the reference implementation of the [Akash Protocol](https://ipfs.io/ipfs/QmdV52bF7j4utynJ6L11RgG93FuJiUmBH1i7pRD6NjUt6B). Akash is an actively-developed prototype currently focused on the distributed marketplace functionality. -The Suite is composed of one binary, `akash`, which contains a ([tendermint](https://github.com/tendermint/tendermint)-powered) blockchain node that +The Suite is composed of one binary, `akash`, which contains a ([tendermint](https://github.com/cometbft/cometbft)-powered) blockchain node that implements the decentralized exchange as well as client functionality to access the exchange and network data in general. ## Get Started with Akash diff --git a/_docs/adr/adr-001-network-upgrades.md b/_docs/adr/adr-001-network-upgrades.md index 2be35cf9ae..8fd574ba7b 100644 --- a/_docs/adr/adr-001-network-upgrades.md +++ b/_docs/adr/adr-001-network-upgrades.md @@ -40,7 +40,7 @@ Each file has steps in form of comment with `StepX` prefix. Each step must be im package v0_24_0 import ( - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/app/ante.go b/app/ante.go index 2e0f63df62..fe824e649a 100644 --- a/app/ante.go +++ b/app/ante.go @@ -1,17 +1,27 @@ package app import ( + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + auctionante "github.com/skip-mev/block-sdk/x/auction/ante" + auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper" - "github.com/akash-network/node/app/decorators" - agovkeeper "github.com/akash-network/node/x/gov/keeper" - astakingkeeper "github.com/akash-network/node/x/staking/keeper" + "pkg.akt.dev/akashd/app/decorators" + agovkeeper "pkg.akt.dev/akashd/x/gov/keeper" + astakingkeeper "pkg.akt.dev/akashd/x/staking/keeper" ) +// BlockSDKAnteHandlerParams are the parameters necessary to configure the block-sdk antehandlers +type BlockSDKAnteHandlerParams struct { + mevLane auctionante.MEVLane + auctionKeeper auctionkeeper.Keeper + txConfig client.TxConfig +} + // HandlerOptions extends the SDK's AnteHandler options type HandlerOptions struct { ante.HandlerOptions @@ -19,6 +29,7 @@ type HandlerOptions struct { AStakingKeeper astakingkeeper.IKeeper GovKeeper *govkeeper.Keeper AGovKeeper agovkeeper.IKeeper + BlockSDK BlockSDKAnteHandlerParams } // NewAnteHandler returns an AnteHandler that checks and increments sequence @@ -26,53 +37,58 @@ type HandlerOptions struct { // signer. func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.AccountKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("account keeper is required for ante builder") } if options.BankKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("bank keeper is required for ante builder") } if options.SignModeHandler == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("sign mode handler is required for ante builder") } if options.SigGasConsumer == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sig gas consumer handler is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("sig gas consumer handler is required for ante builder") } if options.AStakingKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "custom akash staking keeper is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("custom akash staking keeper is required for ante builder") } if options.GovKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "akash governance keeper is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("akash governance keeper is required for ante builder") } if options.AGovKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "custom akash governance keeper is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("custom akash governance keeper is required for ante builder") } if options.FeegrantKeeper == nil { - return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "akash feegrant keeper is required for ante builder") + return nil, sdkerrors.ErrLogic.Wrap("akash feegrant keeper is required for ante builder") } anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first - ante.NewRejectExtensionOptionsDecorator(), - ante.NewMempoolFeeDecorator(), + // ante.NewRejectExtensionOptionsDecorator(), + // ante.NewMempoolFeeDecorator(), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), ante.NewValidateMemoDecorator(options.AccountKeeper), ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), - ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper), + ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, nil), ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators ante.NewValidateSigCountDecorator(options.AccountKeeper), ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), decorators.NewMinCommissionDecorator(options.CDC, options.AStakingKeeper), - decorators.NewGovPreventSpamDecorator(options.CDC, *options.GovKeeper, options.AGovKeeper), + // auction module antehandler + auctionante.NewAuctionDecorator( + options.BlockSDK.auctionKeeper, + options.BlockSDK.txConfig.TxEncoder(), + options.BlockSDK.mevLane, + ), } return sdk.ChainAnteDecorators(anteDecorators...), nil diff --git a/app/app.go b/app/app.go index 0fdd05dc75..50111d8c22 100644 --- a/app/app.go +++ b/app/app.go @@ -6,99 +6,59 @@ import ( "net/http" "os" "path/filepath" + "reflect" "time" - "github.com/cosmos/cosmos-sdk/x/feegrant" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" + "github.com/skip-mev/block-sdk/block" + "github.com/skip-mev/block-sdk/block/base" "github.com/spf13/cast" - abci "github.com/tendermint/tendermint/abci/types" - tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/tendermint/tendermint/libs/log" - tmos "github.com/tendermint/tendermint/libs/os" - tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tm-db" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + tmjson "github.com/cometbft/cometbft/libs/json" + "github.com/cometbft/cometbft/libs/log" + cmos "github.com/cometbft/cometbft/libs/os" + "github.com/skip-mev/block-sdk/abci/checktx" - bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" - authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/crisis" - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - "github.com/cosmos/cosmos-sdk/x/gov" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/cosmos-sdk/x/mint" - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/params" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/cosmos/cosmos-sdk/x/slashing" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-go/v4/modules/apps/transfer" - ibc "github.com/cosmos/ibc-go/v4/modules/core" - porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types" - - icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types" - ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" - ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client" - ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" - ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" + ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" + "github.com/cosmos/ibc-go/v7/testing/simapp" + + apptypes "pkg.akt.dev/akashd/app/types" + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/util/partialord" // unnamed import of statik for swagger UI support - _ "github.com/akash-network/node/client/docs/statik" + _ "pkg.akt.dev/akashd/client/docs/statik" ) const ( @@ -106,8 +66,10 @@ const ( ) var ( - DefaultHome = os.ExpandEnv("$HOME/.akash") - _ servertypes.Application = (*AkashApp)(nil) + DefaultHome = os.ExpandEnv("$HOME/.akash") + + _ runtime.AppI = (*AkashApp)(nil) + _ servertypes.Application = (*AkashApp)(nil) // module accounts that are allowed to receive tokens allowedReceivingModAcc = map[string]bool{} @@ -115,24 +77,17 @@ var ( // AkashApp extends ABCI application type AkashApp struct { - *bam.BaseApp - apptypes.App - cdc *codec.LegacyAmino - appCodec codec.Codec - interfaceRegistry codectypes.InterfaceRegistry - - invCheckPeriod uint + *baseapp.BaseApp + *apptypes.App - keys map[string]*sdk.KVStoreKey - tkeys map[string]*sdk.TransientStoreKey - memkeys map[string]*sdk.MemoryStoreKey - - // simulation manager - sm *module.SimulationManager + aminoCdc *codec.LegacyAmino + cdc codec.Codec + interfaceRegistry codectypes.InterfaceRegistry + checkTxHandler checktx.CheckTx + sm *module.SimulationManager + invCheckPeriod uint } -// https://github.com/cosmos/sdk-tutorials/blob/c6754a1e313eb1ed973c5c91dcc606f2fd288811/app.go#L73 - // NewApp creates and returns a new Akash App. func NewApp( logger log.Logger, @@ -143,7 +98,7 @@ func NewApp( skipUpgradeHeights map[int64]bool, homePath string, appOpts servertypes.AppOptions, - options ...func(*bam.BaseApp), + options ...func(*baseapp.BaseApp), ) *AkashApp { // find out the genesis time, to be used later in inflation calculation // genesisTime := getGenesisTime(appOpts, homePath) @@ -151,302 +106,116 @@ func NewApp( // TODO: Remove cdc in favor of appCodec once all modules are migrated. encodingConfig := MakeEncodingConfig() appCodec := encodingConfig.Marshaler - cdc := encodingConfig.Amino + aminoCdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry + txConfig := encodingConfig.TxConfig + + bapp := baseapp.NewBaseApp(AppName, logger, db, txConfig.TxDecoder(), options...) - bapp := bam.NewBaseApp(AppName, logger, db, encodingConfig.TxConfig.TxDecoder(), options...) bapp.SetCommitMultiStoreTracer(tio) bapp.SetVersion(version.Version) bapp.SetInterfaceRegistry(interfaceRegistry) - - keys := kvStoreKeys() - tkeys := transientStoreKeys() - memkeys := memStoreKeys() + bapp.SetTxEncoder(txConfig.TxEncoder()) app := &AkashApp{ BaseApp: bapp, - cdc: cdc, - appCodec: appCodec, + App: &apptypes.App{}, + aminoCdc: aminoCdc, + cdc: appCodec, interfaceRegistry: interfaceRegistry, invCheckPeriod: invCheckPeriod, - keys: keys, - tkeys: tkeys, - memkeys: memkeys, - } - app.Configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - - app.Keepers.Cosmos.Params = initParamsKeeper(appCodec, cdc, app.keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) - - // set the BaseApp's parameter store - bapp.SetParamStore(app.Keepers.Cosmos.Params.Subspace(bam.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) - - // add capability keeper and ScopeToModule for ibc module - app.Keepers.Cosmos.Cap = capabilitykeeper.NewKeeper( - appCodec, - app.keys[capabilitytypes.StoreKey], - app.memkeys[capabilitytypes.MemStoreKey], - ) - - scopedIBCKeeper := app.Keepers.Cosmos.Cap.ScopeToModule(ibchost.ModuleName) - scopedTransferKeeper := app.Keepers.Cosmos.Cap.ScopeToModule(ibctransfertypes.ModuleName) - - // seal the capability keeper so all persistent capabilities are loaded in-memory and prevent - // any further modules from creating scoped sub-keepers. - app.Keepers.Cosmos.Cap.Seal() - - app.Keepers.Cosmos.Acct = authkeeper.NewAccountKeeper( - appCodec, - app.keys[authtypes.StoreKey], - app.GetSubspace(authtypes.ModuleName), - authtypes.ProtoBaseAccount, - MacPerms(), - ) - - // add authz keeper - app.Keepers.Cosmos.Authz = authzkeeper.NewKeeper(app.keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter()) - - app.Keepers.Cosmos.FeeGrant = feegrantkeeper.NewKeeper( - appCodec, - keys[feegrant.StoreKey], - app.Keepers.Cosmos.Acct, - ) - - app.Keepers.Cosmos.Bank = bankkeeper.NewBaseKeeper( - appCodec, - app.keys[banktypes.StoreKey], - app.Keepers.Cosmos.Acct, - app.GetSubspace(banktypes.ModuleName), - app.BlockedAddrs(), - ) - - // allocation of staking keeper is scoped deliberately, - // so it's being referenced by pointer within modules that need it - { - skeeper := stakingkeeper.NewKeeper( - appCodec, - app.keys[stakingtypes.StoreKey], - app.Keepers.Cosmos.Acct, - app.Keepers.Cosmos.Bank, - app.GetSubspace(stakingtypes.ModuleName), - ) - app.Keepers.Cosmos.Staking = &skeeper } - app.Keepers.Cosmos.Mint = mintkeeper.NewKeeper( - appCodec, - app.keys[minttypes.StoreKey], - app.GetSubspace(minttypes.ModuleName), - app.Keepers.Cosmos.Staking, - app.Keepers.Cosmos.Acct, - app.Keepers.Cosmos.Bank, - authtypes.FeeCollectorName, - ) - - app.Keepers.Cosmos.Distr = distrkeeper.NewKeeper( - appCodec, - app.keys[distrtypes.StoreKey], - app.GetSubspace(distrtypes.ModuleName), - app.Keepers.Cosmos.Acct, - app.Keepers.Cosmos.Bank, - app.Keepers.Cosmos.Staking, - authtypes.FeeCollectorName, - app.ModuleAccountAddrs(), - ) - - app.Keepers.Cosmos.Slashing = slashingkeeper.NewKeeper( - appCodec, - app.keys[slashingtypes.StoreKey], - app.Keepers.Cosmos.Staking, - app.GetSubspace(slashingtypes.ModuleName), - ) - - // register the staking hooks - // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.Keepers.Cosmos.Staking.SetHooks( - stakingtypes.NewMultiStakingHooks( - app.Keepers.Cosmos.Distr.Hooks(), - app.Keepers.Cosmos.Slashing.Hooks(), - ), - ) - - app.Keepers.Cosmos.Crisis = crisiskeeper.NewKeeper( - app.GetSubspace(crisistypes.ModuleName), + app.InitSpecialKeepers( + app.cdc, + aminoCdc, + app.BaseApp, invCheckPeriod, - app.Keepers.Cosmos.Bank, - authtypes.FeeCollectorName, - ) - - app.Keepers.Cosmos.Upgrade = upgradekeeper.NewKeeper( skipUpgradeHeights, - app.keys[upgradetypes.StoreKey], - appCodec, homePath, - app.BaseApp, ) - // register IBC Keeper - app.Keepers.Cosmos.IBC = ibckeeper.NewKeeper( - appCodec, - app.keys[ibchost.StoreKey], - app.GetSubspace(ibchost.ModuleName), - app.Keepers.Cosmos.Staking, - app.Keepers.Cosmos.Upgrade, - scopedIBCKeeper, - ) - - // register the proposal types - govRouter := govtypes.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). - AddRoute( - paramproposal.RouterKey, - params.NewParamChangeProposalHandler(app.Keepers.Cosmos.Params), - ). - AddRoute( - distrtypes.RouterKey, - distr.NewCommunityPoolSpendProposalHandler(app.Keepers.Cosmos.Distr), - ). - AddRoute( - upgradetypes.RouterKey, - upgrade.NewSoftwareUpgradeProposalHandler(app.Keepers.Cosmos.Upgrade), - ). - AddRoute( - ibcclienttypes.RouterKey, - ibcclient.NewClientProposalHandler(app.Keepers.Cosmos.IBC.ClientKeeper), - ) - - app.Keepers.Cosmos.Gov = govkeeper.NewKeeper( - appCodec, - app.keys[govtypes.StoreKey], - app.GetSubspace(govtypes.ModuleName), - app.Keepers.Cosmos.Acct, - app.Keepers.Cosmos.Bank, - app.Keepers.Cosmos.Staking, - govRouter, - ) - - // register Transfer Keepers - app.Keepers.Cosmos.Transfer = ibctransferkeeper.NewKeeper( - appCodec, - app.keys[ibctransfertypes.StoreKey], - app.GetSubspace(ibctransfertypes.ModuleName), - app.Keepers.Cosmos.IBC.ChannelKeeper, - app.Keepers.Cosmos.IBC.ChannelKeeper, - &app.Keepers.Cosmos.IBC.PortKeeper, - app.Keepers.Cosmos.Acct, - app.Keepers.Cosmos.Bank, - scopedTransferKeeper, - ) - - transferModule := transfer.NewAppModule(app.Keepers.Cosmos.Transfer) - transferIBCModule := transfer.NewIBCModule(app.Keepers.Cosmos.Transfer) - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule) - - app.Keepers.Cosmos.IBC.SetRouter(ibcRouter) + // register the upgrade handler + if err := app.registerUpgradeHandlers(); err != nil { + panic(err) + } - // create evidence keeper with evidence router - evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, - app.keys[evidencetypes.StoreKey], - app.Keepers.Cosmos.Staking, - app.Keepers.Cosmos.Slashing, + app.InitNormalKeepers( + app.cdc, + encodingConfig, + app.BaseApp, + ModuleAccountPerms(), + app.BlockedAddrs(), ) - // if evidence needs to be handled for the app, set routes in router here and seal - app.Keepers.Cosmos.Evidence = *evidenceKeeper - - app.setAkashKeepers() + // TODO: There is a bug here, where we register the govRouter routes in InitNormalKeepers and then + // call setupHooks afterwards. Therefore, if a gov proposal needs to call a method and that method calls a + // hook, we will get a nil pointer dereference error due to the hooks in the keeper not being + // setup yet. I will refrain from creating an issue in the sdk for now until after we unfork to 0.47, + // because I believe the concept of Routes is going away. + app.SetupHooks() // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment // we prefer to be more strict in what arguments the modules expect. skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - app.MM = module.NewManager( - append([]module.AppModule{ - genutil.NewAppModule(app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Staking, app.BaseApp.DeliverTx, encodingConfig.TxConfig), - auth.NewAppModule(appCodec, app.Keepers.Cosmos.Acct, nil), - authzmodule.NewAppModule(appCodec, app.Keepers.Cosmos.Authz, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, app.interfaceRegistry), - feegrantmodule.NewAppModule(appCodec, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, app.Keepers.Cosmos.FeeGrant, app.interfaceRegistry), - vesting.NewAppModule(app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank), - bank.NewAppModule(appCodec, app.Keepers.Cosmos.Bank, app.Keepers.Cosmos.Acct), - capability.NewAppModule(appCodec, *app.Keepers.Cosmos.Cap), - crisis.NewAppModule(&app.Keepers.Cosmos.Crisis, skipGenesisInvariants), - gov.NewAppModule(appCodec, app.Keepers.Cosmos.Gov, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank), - mint.NewAppModule(appCodec, app.Keepers.Cosmos.Mint, app.Keepers.Cosmos.Acct), - // todo akash-network/support#4 - // mint.NewAppModule(appCodec, app.Keepers.Cosmos.Mint, app.Keepers.Cosmos.Acct, nil), - slashing.NewAppModule(appCodec, app.Keepers.Cosmos.Slashing, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, app.Keepers.Cosmos.Staking), - distr.NewAppModule(appCodec, app.Keepers.Cosmos.Distr, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, app.Keepers.Cosmos.Staking), - staking.NewAppModule(appCodec, *app.Keepers.Cosmos.Staking, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank), - upgrade.NewAppModule(app.Keepers.Cosmos.Upgrade), - evidence.NewAppModule(app.Keepers.Cosmos.Evidence), - ibc.NewAppModule(app.Keepers.Cosmos.IBC), - params.NewAppModule(app.Keepers.Cosmos.Params), - transferModule, - }, app.akashAppModules()...)..., - ) + // NOTE: All module / keeper changes should happen prior to this module.NewManager line being called. + // However, in the event any changes do need to happen after this call, ensure that that keeper + // is only passed in its keeper form (not de-ref'd anywhere) + // + // Generally NewAppModule will require the keeper that module defines to be passed in as an exact struct, + // but should take in every other keeper as long as it matches a certain interface. (So no need to be de-ref'd) + // + // Any time a module requires a keeper de-ref'd that's not its native one, + // its code-smell and should probably change. We should get the staking keeper dependencies fixed. + app.MM = module.NewManager(appModules(app, encodingConfig, skipGenesisInvariants)...) // During begin block slashing happens after distr.BeginBlocker so that // there is nothing left over in the validator fee pool, to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) - // NOTE: As of v0.45.0 of cosmos SDK, all modules need to be here. - app.MM.SetOrderBeginBlockers( - app.akashBeginBlockModules()..., - ) - app.MM.SetOrderEndBlockers( - app.akashEndBlockModules()..., - ) + // NOTE: capability module's begin-blocker must come before any modules using capabilities (e.g. IBC) - // NOTE: The genutils module must occur after staking so that pools are - // properly initialized with tokens from genesis accounts. - app.MM.SetOrderInitGenesis( - app.akashInitGenesisOrder()..., - ) + // Tell the app's module manager how to set the order of BeginBlockers, which are run at the beginning of every block. + app.MM.SetOrderBeginBlockers(orderBeginBlockers(app.MM.ModuleNames())...) + + // Tell the app's module manager how to set the order of EndBlockers, which are run at the end of every block. + app.MM.SetOrderEndBlockers(OrderEndBlockers(app.MM.ModuleNames())...) - app.MM.RegisterInvariants(&app.Keepers.Cosmos.Crisis) - app.MM.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) + app.MM.SetOrderInitGenesis(OrderInitGenesis(app.MM.ModuleNames())...) + + app.MM.RegisterInvariants(app.Keepers.Cosmos.Crisis) + + app.Configurator = module.NewConfigurator(app.AppCodec(), app.MsgServiceRouter(), app.GRPCQueryRouter()) app.MM.RegisterServices(app.Configurator) - // add test gRPC service for testing gRPC queries in isolation - testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) - - app.sm = module.NewSimulationManager( - append([]module.AppModuleSimulation{ - auth.NewAppModule(appCodec, app.Keepers.Cosmos.Acct, authsims.RandomGenesisAccounts), - authzmodule.NewAppModule(appCodec, app.Keepers.Cosmos.Authz, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, app.interfaceRegistry), - bank.NewAppModule(appCodec, app.Keepers.Cosmos.Bank, app.Keepers.Cosmos.Acct), - feegrantmodule.NewAppModule(appCodec, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, app.Keepers.Cosmos.FeeGrant, app.interfaceRegistry), - capability.NewAppModule(appCodec, *app.Keepers.Cosmos.Cap), - gov.NewAppModule(appCodec, app.Keepers.Cosmos.Gov, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank), - mint.NewAppModule(appCodec, app.Keepers.Cosmos.Mint, app.Keepers.Cosmos.Acct), - // todo akash-network/support#4 - // mint.NewAppModule(appCodec, app.Keepers.Cosmos.Mint, app.Keepers.Cosmos.Acct, nil), - staking.NewAppModule(appCodec, *app.Keepers.Cosmos.Staking, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank), - distr.NewAppModule(appCodec, app.Keepers.Cosmos.Distr, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, *app.Keepers.Cosmos.Staking), - slashing.NewAppModule(appCodec, app.Keepers.Cosmos.Slashing, app.Keepers.Cosmos.Acct, app.Keepers.Cosmos.Bank, *app.Keepers.Cosmos.Staking), - params.NewAppModule(app.Keepers.Cosmos.Params), - evidence.NewAppModule(app.Keepers.Cosmos.Evidence), - ibc.NewAppModule(app.Keepers.Cosmos.IBC), - transferModule, - }, - app.akashSimModules()..., - )..., + app.sm = module.NewSimulationManager(appSimModules(app)...) + app.sm.RegisterStoreDecoders() + + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.MM.Modules)) + + reflectionSvc := getReflectionService() + reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + + // initialize lanes + mempool + mevLane, defaultLane := CreateLanes(app, txConfig) + + // create the mempool + lanedMempool, err := block.NewLanedMempool( + app.Logger(), + []block.Lane{mevLane, defaultLane}, ) + if err != nil { + panic(err) + } - app.sm.RegisterStoreDecoders() + // set the mempool + app.SetMempool(lanedMempool) // initialize stores - app.MountKVStores(keys) - app.MountTransientStores(tkeys) - app.MountMemoryStores(memkeys) - - // initialize BaseApp - app.SetInitChainer(app.InitChainer) - app.SetBeginBlocker(app.BeginBlocker) + app.MountKVStores(app.GetKVStoreKey()) + app.MountTransientStores(app.GetTransientStoreKey()) + app.MountMemoryStores(app.GetMemoryStoreKey()) anteOpts := HandlerOptions{ HandlerOptions: ante.HandlerOptions{ @@ -456,37 +225,96 @@ func NewApp( SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - CDC: app.appCodec, + CDC: app.cdc, AStakingKeeper: app.Keepers.Akash.Staking, - GovKeeper: &app.Keepers.Cosmos.Gov, + GovKeeper: app.Keepers.Cosmos.Gov, AGovKeeper: app.Keepers.Akash.Gov, + BlockSDK: BlockSDKAnteHandlerParams{ + mevLane: mevLane, + auctionKeeper: *app.Keepers.External.Auction, + txConfig: txConfig, + }, } - handler, err := NewAnteHandler(anteOpts) + anteHandler, err := NewAnteHandler(anteOpts) if err != nil { panic(err) } - app.SetAnteHandler(handler) - - app.SetEndBlocker(app.EndBlocker) - // register the upgrade handler - if err = app.registerUpgradeHandlers(); err != nil { - panic(err) + // update ante-handlers on lanes + opt := []base.LaneOption{ + base.WithAnteHandler(anteHandler), } + mevLane.WithOptions(opt...) + defaultLane.WithOptions(opt...) + + // check-tx + mevCheckTxHandler := checktx.NewMEVCheckTxHandler( + app, + txConfig.TxDecoder(), + mevLane, + anteHandler, + app.BaseApp.CheckTx, + app.ChainID(), + ) + + // wrap checkTxHandler with mempool parity handler + parityCheckTx := checktx.NewMempoolParityCheckTx( + app.Logger(), + lanedMempool, + txConfig.TxDecoder(), + mevCheckTxHandler.CheckTx(), + ) + + app.SetCheckTx(parityCheckTx.CheckTx()) + + // initialize BaseApp + app.SetInitChainer(app.InitChainer) + app.SetBeginBlocker(app.BeginBlocker) + + app.SetAnteHandler(anteHandler) + app.SetEndBlocker(app.EndBlocker) + if loadLatest { if err := app.LoadLatestVersion(); err != nil { - tmos.Exit("app initialization:" + err.Error()) + cmos.Exit("app initialization:" + err.Error()) } } - app.Keepers.Cosmos.ScopedIBCKeeper = scopedIBCKeeper - app.Keepers.Cosmos.ScopedTransferKeeper = scopedTransferKeeper - return app } +// orderBeginBlockers returns the order of BeginBlockers, by module name. +func orderBeginBlockers(allModuleNames []string) []string { + ord := partialord.NewPartialOrdering(allModuleNames) + // Upgrades should be run VERY first + ord.FirstElements(upgradetypes.ModuleName, capabilitytypes.ModuleName) + + // Staking ordering + // TODO: Perhaps this can be relaxed, left to future work to analyze. + ord.Sequence(distrtypes.ModuleName, slashingtypes.ModuleName, evidencetypes.ModuleName, stakingtypes.ModuleName) + // TODO: This can almost certainly be un-constrained, but we keep the constraint to match prior functionality. + // IBChost came after staking. + ord.Sequence(stakingtypes.ModuleName, ibchost.ModuleName) + // We leave downtime-detector un-constrained. + // every remaining module's begin block is a no-op. + return ord.TotalOrdering() +} + +// OrderEndBlockers returns EndBlockers (crisis, govtypes, staking) with no relative order. +func OrderEndBlockers(allModuleNames []string) []string { + ord := partialord.NewPartialOrdering(allModuleNames) + + // Staking must be after gov. + ord.FirstElements(govtypes.ModuleName) + ord.LastElements(stakingtypes.ModuleName) + + // only Osmosis modules with endblock code are: twap, crisis, govtypes, staking + // we don't care about the relative ordering between them. + return ord.TotalOrdering() +} + func getGenesisTime(appOpts servertypes.AppOptions, homePath string) time.Time { // nolint: unused,deadcode if v := appOpts.Get("GenesisTime"); v != nil { // in tests, GenesisTime is supplied using appOpts @@ -509,8 +337,8 @@ func getGenesisTime(appOpts servertypes.AppOptions, homePath string) time.Time { // simapp. It is useful for tests and clients who do not want to construct the // full simapp func MakeCodecs() (codec.Codec, *codec.LegacyAmino) { - config := MakeEncodingConfig() - return config.Marshaler, config.Amino + cfg := MakeEncodingConfig() + return cfg.Marshaler, cfg.Amino } // Name returns the name of the App @@ -523,7 +351,7 @@ func (app *AkashApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abc panic(err) } app.Keepers.Cosmos.Upgrade.SetModuleVersionMap(ctx, app.MM.GetVersionMap()) - return app.MM.InitGenesis(ctx, app.appCodec, genesisState) + return app.MM.InitGenesis(ctx, app.cdc, genesisState) } // BeginBlocker is a function in which application updates every begin block @@ -546,23 +374,23 @@ func (app *AkashApp) EndBlocker( // LegacyAmino returns AkashApp's amino codec. func (app *AkashApp) LegacyAmino() *codec.LegacyAmino { - return app.cdc + return app.aminoCdc } // AppCodec returns AkashApp's app codec. func (app *AkashApp) AppCodec() codec.Codec { - return app.appCodec + return app.cdc } // ModuleAccountAddrs returns all the app's module account addresses. func (app *AkashApp) ModuleAccountAddrs() map[string]bool { - return MacAddrs() + return ModuleAccountAddrs() } // BlockedAddrs returns all the app's module account addresses that are not // allowed to receive external tokens. func (app *AkashApp) BlockedAddrs() map[string]bool { - perms := MacPerms() + perms := ModuleAccountAddrs() blockedAddrs := make(map[string]bool) for acc := range perms { blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc] @@ -576,22 +404,6 @@ func (app *AkashApp) InterfaceRegistry() codectypes.InterfaceRegistry { return app.interfaceRegistry } -// GetKey returns the KVStoreKey for the provided store key. -func (app *AkashApp) GetKey(storeKey string) *sdk.KVStoreKey { - return app.keys[storeKey] -} - -// GetTKey returns the TransientStoreKey for the provided store key. -func (app *AkashApp) GetTKey(storeKey string) *sdk.TransientStoreKey { - return app.tkeys[storeKey] -} - -// GetSubspace returns a param subspace for a given module name. -func (app *AkashApp) GetSubspace(moduleName string) paramstypes.Subspace { - subspace, _ := app.Keepers.Cosmos.Params.GetSubspace(moduleName) - return subspace -} - // SimulationManager implements the SimulationApp interface func (app *AkashApp) SimulationManager() *module.SimulationManager { return app.sm @@ -600,22 +412,22 @@ func (app *AkashApp) SimulationManager() *module.SimulationManager { // RegisterAPIRoutes registers all application module routes with the provided // API server. func (app *AkashApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) - // Register legacy tx routes - authrest.RegisterTxRoutes(clientCtx, apiSvr.Router) + cctx := apiSvr.ClientCtx + // Register new tx routes from grpc-gateway - authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + authtx.RegisterGRPCGatewayRoutes(cctx, apiSvr.GRPCGatewayRouter) // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + tmservice.RegisterGRPCGatewayRoutes(cctx, apiSvr.GRPCGatewayRouter) // Register legacy and grpc-gateway routes for all modules. - ModuleBasics().RegisterRESTRoutes(clientCtx, apiSvr.Router) - ModuleBasics().RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + ModuleBasics().RegisterGRPCGatewayRoutes(cctx, apiSvr.GRPCGatewayRouter) + + // Register node gRPC service for grpc-gateway. + nodeservice.RegisterGRPCGatewayRoutes(cctx, apiSvr.GRPCGatewayRouter) // register swagger API from root so that other applications can override easily if apiConfig.Swagger { - RegisterSwaggerAPI(clientCtx, apiSvr.Router) + RegisterSwaggerAPI(cctx, apiSvr.Router) } } @@ -625,8 +437,17 @@ func (app *AkashApp) RegisterTxService(clientCtx client.Context) { } // RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *AkashApp) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) +func (app *AkashApp) RegisterTendermintService(cctx client.Context) { + tmservice.RegisterTendermintService( + cctx, + app.BaseApp.GRPCQueryRouter(), + app.interfaceRegistry, + app.Query) +} + +// RegisterNodeService registers the node gRPC Query service. +func (app *AkashApp) RegisterNodeService(clientCtx client.Context) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) } // RegisterSwaggerAPI registers swagger route with API Server @@ -637,6 +458,7 @@ func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { } staticServer := http.FileServer(statikFS) + rtr.PathPrefix("/static/").Handler(http.StripPrefix("/static/", staticServer)) rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) } @@ -645,24 +467,37 @@ func (app *AkashApp) LoadHeight(height int64) error { return app.LoadVersion(height) } -// initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, - tkey sdk.StoreKey, -) paramskeeper.Keeper { - paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) - paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibchost.ModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) - - return akashSubspaces(paramsKeeper) +// CheckTx will check the transaction with the provided checkTxHandler. We override the default +// handler so that we can verify bid transactions before they are inserted into the mempool. +// With the BlockSDK CheckTx, we can verify the bid transaction and all of the bundled transactions +// before inserting the bid transaction into the mempool. +func (app *AkashApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx { + return app.checkTxHandler(req) +} + +// SetCheckTx sets the checkTxHandler for the app. +func (app *AkashApp) SetCheckTx(handler checktx.CheckTx) { + app.checkTxHandler = handler +} + +// ChainID gets chainID from private fields of BaseApp +// Should be removed once SDK 0.50.x will be adopted +func (app *AkashApp) ChainID() string { + field := reflect.ValueOf(app.BaseApp).Elem().FieldByName("chainID") + return field.String() +} + +// cache the reflectionService to save us time within tests. +var cachedReflectionService *runtimeservices.ReflectionService = nil + +func getReflectionService() *runtimeservices.ReflectionService { + if cachedReflectionService != nil { + return cachedReflectionService + } + reflectionSvc, err := runtimeservices.NewReflectionService() + if err != nil { + panic(err) + } + cachedReflectionService = reflectionSvc + return reflectionSvc } diff --git a/app/app_configure.go b/app/app_configure.go index c2f615de80..cb41eb19d3 100644 --- a/app/app_configure.go +++ b/app/app_configure.go @@ -14,42 +14,33 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" - - audittypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" - certtypes "github.com/akash-network/akash-api/go/node/cert/v1beta3" - deploymenttypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - escrowtypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - inflationtypes "github.com/akash-network/akash-api/go/node/inflation/v1beta3" - markettypes "github.com/akash-network/akash-api/go/node/market/v1beta4" - providertypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - taketypes "github.com/akash-network/akash-api/go/node/take/v1beta3" - - "github.com/akash-network/node/x/audit" - akeeper "github.com/akash-network/node/x/audit/keeper" - "github.com/akash-network/node/x/cert" - ckeeper "github.com/akash-network/node/x/cert/keeper" - "github.com/akash-network/node/x/deployment" - "github.com/akash-network/node/x/escrow" - ekeeper "github.com/akash-network/node/x/escrow/keeper" - agov "github.com/akash-network/node/x/gov" - agovkeeper "github.com/akash-network/node/x/gov/keeper" - "github.com/akash-network/node/x/inflation" - ikeeper "github.com/akash-network/node/x/inflation/keeper" - "github.com/akash-network/node/x/market" - mhooks "github.com/akash-network/node/x/market/hooks" - "github.com/akash-network/node/x/provider" - astaking "github.com/akash-network/node/x/staking" - astakingkeeper "github.com/akash-network/node/x/staking/keeper" - "github.com/akash-network/node/x/take" - tkeeper "github.com/akash-network/node/x/take/keeper" + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" + + audittypes "pkg.akt.dev/go/node/audit/v1" + certtypes "pkg.akt.dev/go/node/cert/v1" + deploymenttypes "pkg.akt.dev/go/node/deployment/v1" + escrowtypes "pkg.akt.dev/go/node/escrow/v1" + inflationtypes "pkg.akt.dev/go/node/inflation/v1beta3" + markettypes "pkg.akt.dev/go/node/market/v1beta5" + providertypes "pkg.akt.dev/go/node/provider/v1beta4" + taketypes "pkg.akt.dev/go/node/take/v1beta3" + + "pkg.akt.dev/akashd/x/audit" + "pkg.akt.dev/akashd/x/cert" + "pkg.akt.dev/akashd/x/deployment" + "pkg.akt.dev/akashd/x/escrow" + agov "pkg.akt.dev/akashd/x/gov" + "pkg.akt.dev/akashd/x/inflation" + "pkg.akt.dev/akashd/x/market" + "pkg.akt.dev/akashd/x/provider" + astaking "pkg.akt.dev/akashd/x/staking" + "pkg.akt.dev/akashd/x/take" ) func akashModuleBasics() []module.AppModuleBasic { @@ -67,167 +58,167 @@ func akashModuleBasics() []module.AppModuleBasic { } } -func akashKVStoreKeys() []string { - return []string{ - take.StoreKey, - escrow.StoreKey, - deployment.StoreKey, - market.StoreKey, - provider.StoreKey, - audit.StoreKey, - cert.StoreKey, - inflation.StoreKey, - astaking.StoreKey, - agov.StoreKey, - } -} - -func akashSubspaces(k paramskeeper.Keeper) paramskeeper.Keeper { - k.Subspace(deployment.ModuleName) - k.Subspace(market.ModuleName) - k.Subspace(inflation.ModuleName) - k.Subspace(astaking.ModuleName) - k.Subspace(agov.ModuleName) - k.Subspace(take.ModuleName) - return k -} - -func (app *AkashApp) setAkashKeepers() { - app.Keepers.Akash.Take = tkeeper.NewKeeper( - app.appCodec, - app.keys[take.StoreKey], - app.GetSubspace(take.ModuleName), - ) - - app.Keepers.Akash.Escrow = ekeeper.NewKeeper( - app.appCodec, - app.keys[escrow.StoreKey], - app.Keepers.Cosmos.Bank, - app.Keepers.Akash.Take, - app.Keepers.Cosmos.Distr, - app.Keepers.Cosmos.Authz, - ) - - app.Keepers.Akash.Deployment = deployment.NewKeeper( - app.appCodec, - app.keys[deployment.StoreKey], - app.GetSubspace(deployment.ModuleName), - app.Keepers.Akash.Escrow, - ) - - app.Keepers.Akash.Market = market.NewKeeper( - app.appCodec, - app.keys[market.StoreKey], - app.GetSubspace(market.ModuleName), - app.Keepers.Akash.Escrow, - ) - - hook := mhooks.New( - app.Keepers.Akash.Deployment, - app.Keepers.Akash.Market, - ) - - app.Keepers.Akash.Escrow.AddOnAccountClosedHook(hook.OnEscrowAccountClosed) - app.Keepers.Akash.Escrow.AddOnPaymentClosedHook(hook.OnEscrowPaymentClosed) - - app.Keepers.Akash.Provider = provider.NewKeeper( - app.appCodec, - app.keys[provider.StoreKey], - ) - - app.Keepers.Akash.Audit = akeeper.NewKeeper( - app.appCodec, - app.keys[audit.StoreKey], - ) - - app.Keepers.Akash.Cert = ckeeper.NewKeeper( - app.appCodec, - app.keys[cert.StoreKey], - ) - - app.Keepers.Akash.Inflation = ikeeper.NewKeeper( - app.appCodec, - app.keys[inflation.StoreKey], - app.GetSubspace(inflation.ModuleName), - ) - - app.Keepers.Akash.Staking = astakingkeeper.NewKeeper( - app.appCodec, - app.keys[astaking.StoreKey], - app.GetSubspace(astaking.ModuleName), - ) - - app.Keepers.Akash.Gov = agovkeeper.NewKeeper( - app.appCodec, - app.keys[agov.StoreKey], - app.GetSubspace(agov.ModuleName), - ) -} - -func (app *AkashApp) akashAppModules() []module.AppModule { - return []module.AppModule{ - take.NewAppModule( - app.appCodec, - app.Keepers.Akash.Take, - ), - - escrow.NewAppModule( - app.appCodec, - app.Keepers.Akash.Escrow, - ), - - deployment.NewAppModule( - app.appCodec, - app.Keepers.Akash.Deployment, - app.Keepers.Akash.Market, - app.Keepers.Akash.Escrow, - app.Keepers.Cosmos.Bank, - app.Keepers.Cosmos.Authz, - ), - - market.NewAppModule( - app.appCodec, - app.Keepers.Akash.Market, - app.Keepers.Akash.Escrow, - app.Keepers.Akash.Audit, - app.Keepers.Akash.Deployment, - app.Keepers.Akash.Provider, - app.Keepers.Cosmos.Bank, - ), - - provider.NewAppModule( - app.appCodec, - app.Keepers.Akash.Provider, - app.Keepers.Cosmos.Bank, - app.Keepers.Akash.Market, - ), - - audit.NewAppModule( - app.appCodec, - app.Keepers.Akash.Audit, - ), - - cert.NewAppModule( - app.appCodec, - app.Keepers.Akash.Cert, - ), - - inflation.NewAppModule( - app.appCodec, - app.Keepers.Akash.Inflation, - ), - - astaking.NewAppModule( - app.appCodec, - app.Keepers.Akash.Staking, - ), - - agov.NewAppModule( - app.appCodec, - app.Keepers.Akash.Gov, - ), - } -} +// func akashKVStoreKeys() []string { +// return []string{ +// take.StoreKey, +// escrow.StoreKey, +// deployment.StoreKey, +// market.StoreKey, +// provider.StoreKey, +// audit.StoreKey, +// cert.StoreKey, +// inflation.StoreKey, +// astaking.StoreKey, +// agov.StoreKey, +// } +// } + +// func akashSubspaces(k paramskeeper.Keeper) paramskeeper.Keeper { +// k.Subspace(deployment.ModuleName) +// k.Subspace(market.ModuleName) +// k.Subspace(inflation.ModuleName) +// k.Subspace(astaking.ModuleName) +// k.Subspace(agov.ModuleName) +// k.Subspace(take.ModuleName) +// return k +// } + +// func (app *AkashApp) setAkashKeepers() { +// app.Keepers.Akash.Take = tkeeper.NewKeeper( +// app.appCodec, +// app.keys[take.StoreKey], +// app.GetSubspace(take.ModuleName), +// ) +// +// app.Keepers.Akash.Escrow = ekeeper.NewKeeper( +// app.appCodec, +// app.keys[escrow.StoreKey], +// app.Keepers.Cosmos.Bank, +// app.Keepers.Akash.Take, +// app.Keepers.Cosmos.Distr, +// app.Keepers.Cosmos.Authz, +// ) +// +// app.Keepers.Akash.Deployment = deployment.NewKeeper( +// app.appCodec, +// app.keys[deployment.StoreKey], +// app.GetSubspace(deployment.ModuleName), +// app.Keepers.Akash.Escrow, +// ) +// +// app.Keepers.Akash.Market = market.NewKeeper( +// app.appCodec, +// app.keys[market.StoreKey], +// app.GetSubspace(market.ModuleName), +// app.Keepers.Akash.Escrow, +// ) +// +// hook := mhooks.New( +// app.Keepers.Akash.Deployment, +// app.Keepers.Akash.Market, +// ) +// +// app.Keepers.Akash.Escrow.AddOnAccountClosedHook(hook.OnEscrowAccountClosed) +// app.Keepers.Akash.Escrow.AddOnPaymentClosedHook(hook.OnEscrowPaymentClosed) +// +// app.Keepers.Akash.Provider = provider.NewKeeper( +// app.appCodec, +// app.keys[provider.StoreKey], +// ) +// +// app.Keepers.Akash.Audit = akeeper.NewKeeper( +// app.appCodec, +// app.keys[audit.StoreKey], +// ) +// +// app.Keepers.Akash.Cert = ckeeper.NewKeeper( +// app.appCodec, +// app.keys[cert.StoreKey], +// ) +// +// app.Keepers.Akash.Inflation = ikeeper.NewKeeper( +// app.appCodec, +// app.keys[inflation.StoreKey], +// app.GetSubspace(inflation.ModuleName), +// ) +// +// app.Keepers.Akash.Staking = astakingkeeper.NewKeeper( +// app.appCodec, +// app.keys[astaking.StoreKey], +// app.GetSubspace(astaking.ModuleName), +// ) +// +// app.Keepers.Akash.Gov = agovkeeper.NewKeeper( +// app.appCodec, +// app.keys[agov.StoreKey], +// app.GetSubspace(agov.ModuleName), +// ) +// } + +// func (app *AkashApp) akashAppModules() []module.AppModule { +// return []module.AppModule{ +// take.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Take, +// ), +// +// escrow.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Escrow, +// ), +// +// deployment.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Deployment, +// app.Keepers.Akash.Market, +// app.Keepers.Akash.Escrow, +// app.Keepers.Cosmos.Bank, +// app.Keepers.Cosmos.Authz, +// ), +// +// market.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Market, +// app.Keepers.Akash.Escrow, +// app.Keepers.Akash.Audit, +// app.Keepers.Akash.Deployment, +// app.Keepers.Akash.Provider, +// app.Keepers.Cosmos.Bank, +// ), +// +// provider.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Provider, +// app.Keepers.Cosmos.Bank, +// app.Keepers.Akash.Market, +// ), +// +// audit.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Audit, +// ), +// +// cert.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Cert, +// ), +// +// inflation.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Inflation, +// ), +// +// astaking.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Staking, +// ), +// +// agov.NewAppModule( +// app.appCodec, +// app.Keepers.Akash.Gov, +// ), +// } +// } // akashBeginBlockModules returns all end block modules. func (app *AkashApp) akashBeginBlockModules() []string { @@ -297,7 +288,13 @@ func (app *AkashApp) akashEndBlockModules() []string { } } -func (app *AkashApp) akashInitGenesisOrder() []string { +// OrderInitGenesis returns module names in order for init genesis calls. +// NOTE: The genutils module must occur after staking so that pools are +// properly initialized with tokens from genesis accounts. +// NOTE: Capability module must occur first so that it can initialize any capabilities +// so that other modules that want to create or claim capabilities afterwards in InitChain +// can do so safely. +func OrderInitGenesis(allModuleNames []string) []string { return []string{ capabilitytypes.ModuleName, authtypes.ModuleName, @@ -329,47 +326,3 @@ func (app *AkashApp) akashInitGenesisOrder() []string { genutiltypes.ModuleName, } } - -func (app *AkashApp) akashSimModules() []module.AppModuleSimulation { - return []module.AppModuleSimulation{ - take.NewAppModuleSimulation( - app.Keepers.Akash.Take, - ), - - deployment.NewAppModuleSimulation( - app.Keepers.Akash.Deployment, - app.Keepers.Cosmos.Acct, - app.Keepers.Cosmos.Bank, - ), - - market.NewAppModuleSimulation( - app.Keepers.Akash.Market, - app.Keepers.Cosmos.Acct, - app.Keepers.Akash.Deployment, - app.Keepers.Akash.Provider, - app.Keepers.Cosmos.Bank, - ), - - provider.NewAppModuleSimulation( - app.Keepers.Akash.Provider, - app.Keepers.Cosmos.Acct, - app.Keepers.Cosmos.Bank, - ), - - cert.NewAppModuleSimulation( - app.Keepers.Akash.Cert, - ), - - inflation.NewAppModuleSimulation( - app.Keepers.Akash.Inflation, - ), - - astaking.NewAppModuleSimulation( - app.Keepers.Akash.Staking, - ), - - agov.NewAppModuleSimulation( - app.Keepers.Akash.Gov, - ), - } -} diff --git a/app/app_test.go b/app/app_test.go index 908e69f4a4..ff072760a1 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -5,11 +5,11 @@ import ( "os" "testing" + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" ) func TestAppExport(t *testing.T) { diff --git a/app/config.go b/app/config.go index 9748de61c0..3c2fb9bc53 100644 --- a/app/config.go +++ b/app/config.go @@ -1,49 +1,32 @@ package app import ( - simparams "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/cosmos/cosmos-sdk/std" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/bank" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/capability" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/evidence" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/gov" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" "github.com/cosmos/cosmos-sdk/x/mint" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/slashing" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/cosmos-sdk/x/upgrade" upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-go/v4/modules/apps/transfer" - ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v4/modules/core" - ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client" - ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibc "github.com/cosmos/ibc-go/v7/modules/core" + ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - appparams "github.com/akash-network/node/app/params" + appparams "pkg.akt.dev/akashd/app/params" ) var mbasics = module.NewBasicManager( @@ -65,9 +48,14 @@ var mbasics = module.NewBasicManager( distr.AppModuleBasic{}, // governance functionality (voting) gov.NewAppModuleBasic( - paramsclient.ProposalHandler, distrclient.ProposalHandler, - upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, - ibcclient.UpdateClientProposalHandler, ibcclient.UpgradeProposalHandler, + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + // distrclient.ProposalHandler, + upgradeclient.LegacyProposalHandler, + upgradeclient.LegacyCancelProposalHandler, + ibcclient.UpdateClientProposalHandler, + ibcclient.UpgradeProposalHandler, + }, ), // chain parameters params.AppModuleBasic{}, @@ -91,45 +79,46 @@ func ModuleBasics() module.BasicManager { } // MakeEncodingConfig creates an EncodingConfig for testing -func MakeEncodingConfig() simparams.EncodingConfig { +func MakeEncodingConfig() appparams.EncodingConfig { encodingConfig := appparams.MakeEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - mbasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - mbasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} - -func kvStoreKeys() map[string]*sdk.KVStoreKey { - return sdk.NewKVStoreKeys( - append([]string{ - authtypes.StoreKey, - feegrant.StoreKey, - authzkeeper.StoreKey, - banktypes.StoreKey, - stakingtypes.StoreKey, - minttypes.StoreKey, - distrtypes.StoreKey, - slashingtypes.StoreKey, - govtypes.StoreKey, - paramstypes.StoreKey, - ibchost.StoreKey, - upgradetypes.StoreKey, - evidencetypes.StoreKey, - ibctransfertypes.StoreKey, - capabilitytypes.StoreKey, - }, - akashKVStoreKeys()..., - )..., - ) -} + ModuleBasics().RegisterLegacyAminoCodec(encodingConfig.Amino) + ModuleBasics().RegisterInterfaces(encodingConfig.InterfaceRegistry) -func transientStoreKeys() map[string]*sdk.TransientStoreKey { - return sdk.NewTransientStoreKeys(paramstypes.TStoreKey) + return encodingConfig } -func memStoreKeys() map[string]*sdk.MemoryStoreKey { - return sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) -} +// func kvStoreKeys() map[string]*storetypes.KVStoreKey { +// return sdk.NewKVStoreKeys( +// append([]string{ +// authtypes.StoreKey, +// feegrant.StoreKey, +// authzkeeper.StoreKey, +// banktypes.StoreKey, +// stakingtypes.StoreKey, +// minttypes.StoreKey, +// distrtypes.StoreKey, +// slashingtypes.StoreKey, +// govtypes.StoreKey, +// paramstypes.StoreKey, +// ibchost.StoreKey, +// upgradetypes.StoreKey, +// evidencetypes.StoreKey, +// ibctransfertypes.StoreKey, +// capabilitytypes.StoreKey, +// }, +// akashKVStoreKeys()..., +// )..., +// ) +// } +// +// func transientStoreKeys() map[string]*storetypes.TransientStoreKey { +// return sdk.NewTransientStoreKeys(paramstypes.TStoreKey) +// } +// +// func memStoreKeys() map[string]*storetypes.MemoryStoreKey { +// return sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) +// } diff --git a/app/decorators/gov_filter.go b/app/decorators/gov_filter.go deleted file mode 100644 index ed05630e15..0000000000 --- a/app/decorators/gov_filter.go +++ /dev/null @@ -1,92 +0,0 @@ -package decorators - -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/authz" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - agovkeeper "github.com/akash-network/node/x/gov/keeper" -) - -type GovPreventSpamDecorator struct { - cdc codec.BinaryCodec - govKeeper govkeeper.Keeper - aGovKeeper agovkeeper.IKeeper -} - -func NewGovPreventSpamDecorator(cdc codec.BinaryCodec, gov govkeeper.Keeper, aGov agovkeeper.IKeeper) GovPreventSpamDecorator { - return GovPreventSpamDecorator{ - cdc: cdc, - govKeeper: gov, - aGovKeeper: aGov, - } -} - -func (gpsd GovPreventSpamDecorator) AnteHandle( - ctx sdk.Context, tx sdk.Tx, - simulate bool, next sdk.AnteHandler, -) (newCtx sdk.Context, err error) { - msgs := tx.GetMsgs() - - err = gpsd.checkSpamSubmitProposalMsg(ctx, msgs) - - if err != nil { - return ctx, err - } - - return next(ctx, tx, simulate) -} - -func (gpsd GovPreventSpamDecorator) checkSpamSubmitProposalMsg(ctx sdk.Context, msgs []sdk.Msg) error { - validMsg := func(m sdk.Msg) error { - if msg, ok := m.(*govtypes.MsgSubmitProposal); ok { - // prevent spam gov msg - depositParams := gpsd.govKeeper.GetDepositParams(ctx) - aDepositParams := gpsd.aGovKeeper.GetDepositParams(ctx) - - minimumInitialDeposit := gpsd.calcMinimumInitialDeposit(aDepositParams.MinInitialDepositRate, depositParams.MinDeposit) - if msg.InitialDeposit.IsAllLT(minimumInitialDeposit) { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "not enough initial deposit. required: %v", minimumInitialDeposit) - } - } - return nil - } - - // Check every msg in the tx, if it's a MsgExec, check the inner msgs. - // If it's a MsgSubmitProposal, check the initial deposit is enough. - for _, m := range msgs { - var innerMsg sdk.Msg - if msg, ok := m.(*authz.MsgExec); ok { - for _, v := range msg.Msgs { - err := gpsd.cdc.UnpackAny(v, &innerMsg) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "cannot unmarshal authz exec msgs") - } - - err = validMsg(innerMsg) - if err != nil { - return err - } - } - } else { - err := validMsg(m) - if err != nil { - return err - } - } - } - - return nil -} - -func (gpsd GovPreventSpamDecorator) calcMinimumInitialDeposit(rate sdk.Dec, minDeposit sdk.Coins) (minimumInitialDeposit sdk.Coins) { - for _, coin := range minDeposit { - minimumInitialCoin := rate.MulInt(coin.Amount).RoundInt() - minimumInitialDeposit = minimumInitialDeposit.Add(sdk.NewCoin(coin.Denom, minimumInitialCoin)) - } - - return -} diff --git a/app/decorators/min_commision.go b/app/decorators/min_commision.go index 9fd47dced9..77e834abf1 100644 --- a/app/decorators/min_commision.go +++ b/app/decorators/min_commision.go @@ -1,15 +1,13 @@ package decorators import ( - "fmt" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/authz" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - astakingkeeper "github.com/akash-network/node/x/staking/keeper" + astakingkeeper "pkg.akt.dev/akashd/x/staking/keeper" ) type MinCommissionDecorator struct { @@ -18,12 +16,10 @@ type MinCommissionDecorator struct { } func NewMinCommissionDecorator(cdc codec.BinaryCodec, k astakingkeeper.IKeeper) *MinCommissionDecorator { - min := &MinCommissionDecorator{ + return &MinCommissionDecorator{ cdc: cdc, keeper: k, } - - return min } func (min *MinCommissionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { @@ -60,11 +56,11 @@ func (min *MinCommissionDecorator) isValidMsg(ctx sdk.Context, m sdk.Msg) error // prevent new validators joining the set with // commission set below 5% if rate.LT(minRate) { - return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, fmt.Sprintf("commission can't be lower than %s%%", minRate)) + return sdkerrors.ErrUnauthorized.Wrapf("commission can't be lower than %s%%", minRate) } if maxRate != nil && maxRate.LT(minRate) { - return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, fmt.Sprintf("commission max rate can't be lower than %s%%", minRate)) + return sdkerrors.ErrUnauthorized.Wrapf("commission max rate can't be lower than %s%%", minRate) } return nil @@ -75,7 +71,7 @@ func (min *MinCommissionDecorator) isValidAuthz(ctx sdk.Context, execMsg *authz. var innerMsg sdk.Msg err := min.cdc.UnpackAny(v, &innerMsg) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "cannot unmarshal authz exec msgs") + return sdkerrors.ErrUnauthorized.Wrap("cannot unmarshal authz exec msgs") } err = min.isValidMsg(ctx, innerMsg) diff --git a/app/export.go b/app/export.go index e86f20b398..1315d80458 100644 --- a/app/export.go +++ b/app/export.go @@ -7,27 +7,29 @@ import ( "github.com/spf13/viper" - abci "github.com/tendermint/tendermint/abci/types" - logger "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + logger "github.com/cometbft/cometbft/libs/log" + cmproto "github.com/cometbft/cometbft/proto/tendermint/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/simulation" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/ibc-go/v7/testing/simapp" ) // ExportAppStateAndValidators exports the state of the application for a genesis // file. func (app *AkashApp) ExportAppStateAndValidators( - forZeroHeight bool, jailAllowedAddrs []string, + forZeroHeight bool, + jailAllowedAddrs []string, + modulesToExport []string, ) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContext(true, cmproto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which // Tendermint will start InitChain. @@ -38,16 +40,17 @@ func (app *AkashApp) ExportAppStateAndValidators( app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.MM.ExportGenesis(ctx, app.appCodec) + genState := app.MM.ExportGenesisForModules(ctx, app.cdc, modulesToExport) appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err } - validators, err := staking.WriteValidators(ctx, *app.Keepers.Cosmos.Staking) + validators, err := staking.WriteValidators(ctx, app.Keepers.Cosmos.Staking) if err != nil { return servertypes.ExportedApp{}, err } + return servertypes.ExportedApp{ AppState: appState, Validators: validators, @@ -121,7 +124,9 @@ func (app *AkashApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs feePool := app.Keepers.Cosmos.Distr.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) app.Keepers.Cosmos.Distr.SetFeePool(ctx, feePool) - app.Keepers.Cosmos.Distr.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + + _ = app.Keepers.Cosmos.Distr.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + return false }) @@ -136,8 +141,8 @@ func (app *AkashApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs if err != nil { panic(err) } - app.Keepers.Cosmos.Distr.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) - app.Keepers.Cosmos.Distr.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) + _ = app.Keepers.Cosmos.Distr.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) + _ = app.Keepers.Cosmos.Distr.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) } // reset context height @@ -165,7 +170,7 @@ func (app *AkashApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. - store := ctx.KVStore(app.keys[stakingtypes.StoreKey]) + store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) diff --git a/app/lanes.go b/app/lanes.go new file mode 100644 index 0000000000..1b1ff31eb8 --- /dev/null +++ b/app/lanes.go @@ -0,0 +1,80 @@ +package app + +import ( + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" + + signerextraction "github.com/skip-mev/block-sdk/adapters/signer_extraction_adapter" + "github.com/skip-mev/block-sdk/block/base" + defaultlane "github.com/skip-mev/block-sdk/lanes/base" + mevlane "github.com/skip-mev/block-sdk/lanes/mev" +) + +const ( + maxTxPerTopOfBlockAuctionLane = 500 // this is the maximum # of bids that will be held in the app-side in-memory mempool + maxTxPerDefaultLane = 3000 // all other txs +) + +var ( + defaultLaneBlockspacePercentage = math.LegacyMustNewDecFromStr("0.90") + topOfBlockAuctionLaneBlockspacePercentage = math.LegacyMustNewDecFromStr("0.10") +) + +// CreateLanes walks through the process of creating the lanes for the block sdk. In this function +// we create three separate lanes - MEV, Free, and Default - and then return them. +func CreateLanes(app *AkashApp, txConfig client.TxConfig) (*mevlane.MEVLane, *base.BaseLane) { + // Create the signer extractor. This is used to extract the expected signers from + // a transaction. Each lane can have a different signer extractor if needed. + signerAdapter := signerextraction.NewDefaultAdapter() + + // Create the configurations for each lane. These configurations determine how many + // transactions the lane can store, the maximum block space the lane can consume, and + // the signer extractor used to extract the expected signers from a transaction. + + // Create a mev configuration that accepts maxTxPerTopOfBlockAuctionLane transactions and consumes topOfBlockAuctionLaneBlockspacePercentage of the + // block space. + mevConfig := base.LaneConfig{ + Logger: app.Logger(), + TxEncoder: txConfig.TxEncoder(), + TxDecoder: txConfig.TxDecoder(), + MaxBlockSpace: topOfBlockAuctionLaneBlockspacePercentage, + SignerExtractor: signerAdapter, + MaxTxs: maxTxPerTopOfBlockAuctionLane, + } + + // Create a default configuration that accepts maxTxPerDefaultLane transactions and consumes defaultLaneBlockspacePercentage of the + // block space. + defaultConfig := base.LaneConfig{ + Logger: app.Logger(), + TxEncoder: txConfig.TxEncoder(), + TxDecoder: txConfig.TxDecoder(), + MaxBlockSpace: defaultLaneBlockspacePercentage, + SignerExtractor: signerAdapter, + MaxTxs: maxTxPerDefaultLane, + } + + // Create the match handlers for each lane. These match handlers determine whether or not + // a transaction belongs in the lane. + + // Create the final match handler for the mev lane. + factory := mevlane.NewDefaultAuctionFactory(txConfig.TxDecoder(), signerAdapter) + mevMatchHandler := factory.MatchHandler() + + // Create the final match handler for the default lane. I.e this will direct all txs that are + // not free nor mev to this lane + defaultMatchHandler := base.DefaultMatchHandler() + + // Create the lanes. + mevLane := mevlane.NewMEVLane( + mevConfig, + factory, + mevMatchHandler, + ) + + defaultLane := defaultlane.NewDefaultLane( + defaultConfig, + defaultMatchHandler, + ) + + return mevLane, defaultLane +} diff --git a/app/mac.go b/app/mac.go index 5546923678..fdc826761c 100644 --- a/app/mac.go +++ b/app/mac.go @@ -6,12 +6,12 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - escrowtypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + escrowtypes "pkg.akt.dev/go/node/escrow/v1" ) -func MacPerms() map[string][]string { +func ModuleAccountPerms() map[string][]string { return map[string][]string{ authtypes.FeeCollectorName: nil, escrowtypes.ModuleName: nil, @@ -24,8 +24,8 @@ func MacPerms() map[string][]string { } } -func MacAddrs() map[string]bool { - perms := MacPerms() +func ModuleAccountAddrs() map[string]bool { + perms := ModuleAccountPerms() addrs := make(map[string]bool, len(perms)) for k := range perms { addrs[authtypes.NewModuleAddress(k).String()] = true diff --git a/app/modules.go b/app/modules.go new file mode 100644 index 0000000000..c632868dc1 --- /dev/null +++ b/app/modules.go @@ -0,0 +1,349 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/capability" + "github.com/cosmos/cosmos-sdk/x/crisis" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/evidence" + feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" + "github.com/cosmos/cosmos-sdk/x/genutil" + "github.com/cosmos/cosmos-sdk/x/gov" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/mint" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/params" + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/cosmos-sdk/x/upgrade" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibc "github.com/cosmos/ibc-go/v7/modules/core" + + appparams "pkg.akt.dev/akashd/app/params" + "pkg.akt.dev/akashd/x/audit" + "pkg.akt.dev/akashd/x/cert" + "pkg.akt.dev/akashd/x/deployment" + "pkg.akt.dev/akashd/x/escrow" + agov "pkg.akt.dev/akashd/x/gov" + "pkg.akt.dev/akashd/x/inflation" + "pkg.akt.dev/akashd/x/market" + "pkg.akt.dev/akashd/x/provider" + astaking "pkg.akt.dev/akashd/x/staking" + "pkg.akt.dev/akashd/x/take" +) + +func appModules( + app *AkashApp, + encodingConfig appparams.EncodingConfig, + skipGenesisInvariants bool, +) []module.AppModule { + cdc := encodingConfig.Marshaler + + return []module.AppModule{ + genutil.NewAppModule( + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Staking, + app.BaseApp.DeliverTx, + encodingConfig.TxConfig, + ), + auth.NewAppModule( + cdc, + app.Keepers.Cosmos.Acct, + nil, + app.GetSubspace(authtypes.ModuleName), + ), + vesting.NewAppModule( + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + ), + bank.NewAppModule( + cdc, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Acct, + app.GetSubspace(banktypes.ModuleName), + ), + capability.NewAppModule( + cdc, + *app.Keepers.Cosmos.Cap, + false, + ), + gov.NewAppModule( + cdc, + app.Keepers.Cosmos.Gov, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.GetSubspace(govtypes.ModuleName), + ), + mint.NewAppModule( + cdc, + app.Keepers.Cosmos.Mint, + app.Keepers.Cosmos.Acct, + minttypes.DefaultInflationCalculationFn, // todo akash-network/support#4 + app.GetSubspace(minttypes.ModuleName), + ), + slashing.NewAppModule( + cdc, + app.Keepers.Cosmos.Slashing, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Staking, + app.GetSubspace(slashingtypes.ModuleName), + ), + distr.NewAppModule( + cdc, + app.Keepers.Cosmos.Distr, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Staking, + app.GetSubspace(distrtypes.ModuleName), + ), + staking.NewAppModule( + cdc, + app.Keepers.Cosmos.Staking, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.GetSubspace(stakingtypes.ModuleName), + ), + upgrade.NewAppModule( + app.Keepers.Cosmos.Upgrade, + ), + evidence.NewAppModule( + *app.Keepers.Cosmos.Evidence, + ), + authzmodule.NewAppModule( + cdc, app.Keepers.Cosmos.Authz, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.interfaceRegistry, + ), + feegrantmodule.NewAppModule( + cdc, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.FeeGrant, + app.interfaceRegistry, + ), + ibc.NewAppModule( + app.Keepers.Cosmos.IBC, + ), + transfer.NewAppModule( + app.Keepers.Cosmos.Transfer, + ), + params.NewAppModule( + app.Keepers.Cosmos.Params, + ), + crisis.NewAppModule( + app.Keepers.Cosmos.Crisis, + skipGenesisInvariants, + app.GetSubspace(crisistypes.ModuleName), + ), + + // akash modules + take.NewAppModule( + app.cdc, + app.Keepers.Akash.Take, + ), + + escrow.NewAppModule( + app.cdc, + app.Keepers.Akash.Escrow, + ), + + deployment.NewAppModule( + app.cdc, + app.Keepers.Akash.Deployment, + app.Keepers.Akash.Market, + app.Keepers.Akash.Escrow, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Authz, + ), + + market.NewAppModule( + app.cdc, + app.Keepers.Akash.Market, + app.Keepers.Akash.Escrow, + app.Keepers.Akash.Audit, + app.Keepers.Akash.Deployment, + app.Keepers.Akash.Provider, + app.Keepers.Cosmos.Bank, + ), + + provider.NewAppModule( + app.cdc, + app.Keepers.Akash.Provider, + app.Keepers.Cosmos.Bank, + app.Keepers.Akash.Market, + ), + + audit.NewAppModule( + app.cdc, + app.Keepers.Akash.Audit, + ), + + cert.NewAppModule( + app.cdc, + app.Keepers.Akash.Cert, + ), + + inflation.NewAppModule( + app.cdc, + app.Keepers.Akash.Inflation, + ), + + astaking.NewAppModule( + app.cdc, + app.Keepers.Akash.Staking, + ), + + agov.NewAppModule( + app.cdc, + app.Keepers.Akash.Gov, + ), + } +} + +func appSimModules( + app *AkashApp, +) []module.AppModuleSimulation { + return []module.AppModuleSimulation{ + auth.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Acct, + authsims.RandomGenesisAccounts, + app.GetSubspace(authtypes.ModuleName), + ), + authzmodule.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Authz, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.interfaceRegistry, + ), + bank.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Acct, + app.GetSubspace(banktypes.ModuleName), + ), + feegrantmodule.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.FeeGrant, + app.interfaceRegistry, + ), + capability.NewAppModule( + app.cdc, + *app.Keepers.Cosmos.Cap, + false, + ), + authzmodule.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Authz, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.interfaceRegistry, + ), + gov.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Gov, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.GetSubspace(govtypes.ModuleName), + ), + mint.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Mint, + app.Keepers.Cosmos.Acct, + minttypes.DefaultInflationCalculationFn, // todo akash-network/support#4 + app.GetSubspace(minttypes.ModuleName), + ), + staking.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Staking, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.GetSubspace(stakingtypes.ModuleName), + ), + distr.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Distr, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Staking, + app.GetSubspace(distrtypes.ModuleName), + ), + slashing.NewAppModule( + app.cdc, + app.Keepers.Cosmos.Slashing, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Staking, + app.GetSubspace(slashingtypes.ModuleName), + ), + params.NewAppModule( + app.Keepers.Cosmos.Params, + ), + evidence.NewAppModule( + *app.Keepers.Cosmos.Evidence, + ), + ibc.NewAppModule( + app.Keepers.Cosmos.IBC, + ), + transfer.NewAppModule( + app.Keepers.Cosmos.Transfer, + ), + + // // akash sim modules + // take.NewAppModuleSimulation( + // app.Keepers.Akash.Take, + // ), + // + // deployment.NewAppModuleSimulation( + // app.Keepers.Akash.Deployment, + // app.Keepers.Cosmos.Acct, + // app.Keepers.Cosmos.Bank, + // ), + // + // market.NewAppModuleSimulation( + // app.Keepers.Akash.Market, + // app.Keepers.Cosmos.Acct, + // app.Keepers.Akash.Deployment, + // app.Keepers.Akash.Provider, + // app.Keepers.Cosmos.Bank, + // ), + // + // provider.NewAppModuleSimulation( + // app.Keepers.Akash.Provider, + // app.Keepers.Cosmos.Acct, + // app.Keepers.Cosmos.Bank, + // ), + // + // cert.NewAppModuleSimulation( + // app.Keepers.Akash.Cert, + // ), + // + // inflation.NewAppModuleSimulation( + // app.Keepers.Akash.Inflation, + // ), + // + // astaking.NewAppModuleSimulation( + // app.Keepers.Akash.Staking, + // ), + // + // agov.NewAppModuleSimulation( + // app.Keepers.Akash.Gov, + // ), + } +} diff --git a/app/params/encoding.go b/app/params/encoding.go new file mode 100644 index 0000000000..3d634abf16 --- /dev/null +++ b/app/params/encoding.go @@ -0,0 +1,16 @@ +package params + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" +) + +// EncodingConfig specifies the concrete encoding types to use for a given app. +// This is provided for compatibility between protobuf and amino implementations. +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Marshaler codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} diff --git a/app/params/proto.go b/app/params/proto.go index b71f91e67c..c984f522ab 100644 --- a/app/params/proto.go +++ b/app/params/proto.go @@ -1,20 +1,21 @@ +//go:build !test_amino + package params import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" - simparams "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/cosmos/cosmos-sdk/x/auth/tx" ) // MakeEncodingConfig creates an EncodingConfig for a proto based test configuration. -func MakeEncodingConfig() simparams.EncodingConfig { +func MakeEncodingConfig() EncodingConfig { amino := codec.NewLegacyAmino() interfaceRegistry := types.NewInterfaceRegistry() marshaler := codec.NewProtoCodec(interfaceRegistry) txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) - return simparams.EncodingConfig{ + return EncodingConfig{ InterfaceRegistry: interfaceRegistry, Marshaler: marshaler, TxConfig: txCfg, diff --git a/app/sim_test.go b/app/sim_test.go index 53e8617f2b..26b63416e1 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -1,308 +1,306 @@ package app -import ( - "encoding/json" - "fmt" - "math/rand" - "os" - "testing" - - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/simapp/helpers" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cosmos/cosmos-sdk/x/simulation" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" -) - -// Get flags every time the simulator is run -var ( - _ = func() string { - simapp.GetSimulatorFlags() - return "" - }() -) - -type StoreKeysPrefixes struct { - A sdk.StoreKey - B sdk.StoreKey - Prefixes [][]byte -} - -// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of -// an IAVLStore for faster simulation speed. -func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { - bapp.SetFauxMerkleMode() -} - -// interBlockCacheOpt returns a BaseApp option function that sets the persistent -// inter-block write-through cache. -func interBlockCacheOpt() func(*baseapp.BaseApp) { - return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager()) -} - -func simulateFromSeedFunc(t *testing.T, newApp *AkashApp, config simtypes.Config) (bool, simulation.Params, error) { - return simulation.SimulateFromSeed( - t, os.Stdout, newApp.BaseApp, simapp.AppStateFn(newApp.AppCodec(), newApp.SimulationManager()), - simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simapp.SimulationOperations(newApp, newApp.AppCodec(), config), - newApp.ModuleAccountAddrs(), config, - newApp.AppCodec(), - ) -} - -func TestFullAppSimulation(t *testing.T) { - config, db, dir, logger, skip, err := simapp.SetupSimulation("leveldb-app-sim", "Simulation") - if skip { - t.Skip("skipping application simulation") - } - - require.NoError(t, err, "simulation setup failed") - - defer func() { - _ = db.Close() - require.NoError(t, os.RemoveAll(dir)) - }() - - app1 := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) - require.Equal(t, "akash", app1.Name()) - - fmt.Printf("config-------- %v", config) - // run randomized simulation - _, simParams, simErr := simulateFromSeedFunc(t, app1, config) - - // export state and simParams before the simulation error is checked - err = simapp.CheckExportSimulation(app1, config, simParams) - require.NoError(t, err) - require.NoError(t, simErr) - - if config.Commit { - simapp.PrintStats(db) - } -} - -func TestAppImportExport(t *testing.T) { - config, db, dir, logger, skip, err := simapp.SetupSimulation("leveldb-app-sim", "Simulation") - if skip { - t.Skip("skipping application import/export simulation") - } - require.NoError(t, err, "simulation setup failed") - - defer func() { - db.Close() - require.NoError(t, os.RemoveAll(dir)) - }() - - app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) - require.Equal(t, AppName, app.Name()) - - // Run randomized simulation - _, simParams, simErr := simulateFromSeedFunc(t, app, config) - - // export state and simParams before the simulation error is checked - err = simapp.CheckExportSimulation(app, config, simParams) - require.NoError(t, err) - require.NoError(t, simErr) - - if config.Commit { - simapp.PrintStats(db) - } - - fmt.Printf("exporting genesis...\n") - - exported, err := app.ExportAppStateAndValidators(false, []string{}) - require.NoError(t, err) - - fmt.Printf("importing genesis...\n") - - _, newDB, newDir, _, _, err := simapp.SetupSimulation("leveldb-app-sim-2", "Simulation-2") - require.NoError(t, err, "simulation setup failed") - - defer func() { - newDB.Close() - require.NoError(t, os.RemoveAll(newDir)) - }() - - newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) - require.Equal(t, AppName, newApp.Name()) - - var genesisState simapp.GenesisState - err = json.Unmarshal(exported.AppState, &genesisState) - require.NoError(t, err) - - ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - - newApp.MM.InitGenesis(ctxB, app.AppCodec(), genesisState) - newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) - - fmt.Printf("comparing stores...\n") - - storeKeysPrefixes := []StoreKeysPrefixes{ - {app.keys[authtypes.StoreKey], newApp.keys[authtypes.StoreKey], [][]byte{}}, - { - app.keys[stakingtypes.StoreKey], newApp.keys[stakingtypes.StoreKey], - [][]byte{ - stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, - }, - }, // ordering may change but it doesn't matter - {app.keys[slashingtypes.StoreKey], newApp.keys[slashingtypes.StoreKey], [][]byte{}}, - {app.keys[minttypes.StoreKey], newApp.keys[minttypes.StoreKey], [][]byte{}}, - {app.keys[distrtypes.StoreKey], newApp.keys[distrtypes.StoreKey], [][]byte{}}, - {app.keys[banktypes.StoreKey], newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}}, - {app.keys[paramtypes.StoreKey], newApp.keys[paramtypes.StoreKey], [][]byte{}}, - {app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}}, - {app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}}, - {app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}}, - {app.keys[ibchost.StoreKey], newApp.keys[ibchost.StoreKey], [][]byte{}}, - {app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}}, - } - - for _, skp := range storeKeysPrefixes { - storeA := ctxA.KVStore(skp.A) - storeB := ctxB.KVStore(skp.B) - - failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) - require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") - - fmt.Printf("compared %d key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, len(failedKVAs), 0, simapp.GetSimulationLog(skp.A.Name(), - app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) - } -} - -func TestAppSimulationAfterImport(t *testing.T) { - config, db, dir, logger, skip, err := simapp.SetupSimulation("leveldb-app-sim", "Simulation") - if skip { - t.Skip("skipping application simulation after import") - } - - require.NoError(t, err, "simulation setup failed") - - defer func() { - db.Close() - require.NoError(t, os.RemoveAll(dir)) - }() - - app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) - require.Equal(t, AppName, app.Name()) - - // Run randomized simulation - stopEarly, simParams, simErr := simulateFromSeedFunc(t, app, config) - - // export state and simParams before the simulation error is checked - err = simapp.CheckExportSimulation(app, config, simParams) - require.NoError(t, err) - require.NoError(t, simErr) - - if config.Commit { - simapp.PrintStats(db) - } - - if stopEarly { - fmt.Println("can't export or import a zero-validator genesis, exiting test...") - return - } - - fmt.Printf("exporting genesis...\n") - - exported, err := app.ExportAppStateAndValidators(true, []string{}) - require.NoError(t, err) - - fmt.Printf("importing genesis...\n") - - _, newDB, newDir, _, val, err := simapp.SetupSimulation("leveldb-app-sim-2", "Simulation-2") - require.NoError(t, err, "simulation setup failed", val) - - defer func() { - newDB.Close() - require.NoError(t, os.RemoveAll(newDir)) - }() - - newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) - require.Equal(t, AppName, newApp.Name()) - - newApp.InitChain(abci.RequestInitChain{ - AppStateBytes: exported.AppState, - }) - - _, _, err = simulateFromSeedFunc(t, newApp, config) - require.NoError(t, err) -} - -func TestAppStateDeterminism(t *testing.T) { - if !simapp.FlagEnabledValue { - t.Skip("skipping application simulation") - } - - config := simapp.NewConfigFromFlags() - config.InitialBlockHeight = 1 - config.ExportParamsPath = "" - config.OnOperation = false - config.AllInvariants = false - config.ChainID = helpers.SimAppChainID - - numSeeds := 2 - numTimesToRunPerSeed := 2 - appHashList := make([]json.RawMessage, numTimesToRunPerSeed) - - for i := 0; i < numSeeds; i++ { - config.Seed = rand.Int63() // nolint:gosec - - for j := 0; j < numTimesToRunPerSeed; j++ { - var logger log.Logger - if simapp.FlagVerboseValue { - logger = log.TestingLogger() - } else { - logger = log.NewNopLogger() - } - - db := dbm.NewMemDB() - - app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), interBlockCacheOpt()) - - fmt.Printf( - "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", - config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - - _, _, err := simulateFromSeedFunc(t, app, config) - require.NoError(t, err) - - if config.Commit { - simapp.PrintStats(db) - } - - appHash := app.LastCommitID().Hash - appHashList[j] = appHash - - if j != 0 { - require.Equal( - t, appHashList[0], appHashList[j], - "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", - config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - } - } - } -} +// import ( +// "encoding/json" +// "fmt" +// "math/rand" +// "os" +// "testing" +// +// dbm "github.com/cometbft/cometbft-db" +// abci "github.com/cometbft/cometbft/abci/types" +// "github.com/cometbft/cometbft/libs/log" +// tmproto "github.com/cometbft/cometbft/proto/tendermint/types" +// "github.com/stretchr/testify/require" +// +// "github.com/cosmos/cosmos-sdk/baseapp" +// "github.com/cosmos/cosmos-sdk/store" +// sdk "github.com/cosmos/cosmos-sdk/types" +// simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +// banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +// capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" +// distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" +// evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" +// govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +// minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" +// paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +// "github.com/cosmos/cosmos-sdk/x/simulation" +// slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" +// stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +// ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" +// ibchost "github.com/cosmos/ibc-go/v7/modules/core/24-host" +// ) +// +// // Get flags every time the simulator is run +// var ( +// _ = func() string { +// simapp.GetSimulatorFlags() +// return "" +// }() +// ) +// +// type StoreKeysPrefixes struct { +// A sdk.StoreKey +// B sdk.StoreKey +// Prefixes [][]byte +// } +// +// // fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of +// // an IAVLStore for faster simulation speed. +// func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { +// bapp.SetFauxMerkleMode() +// } +// +// // interBlockCacheOpt returns a BaseApp option function that sets the persistent +// // inter-block write-through cache. +// func interBlockCacheOpt() func(*baseapp.BaseApp) { +// return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager()) +// } +// +// func simulateFromSeedFunc(t *testing.T, newApp *AkashApp, config simtypes.Config) (bool, simulation.Params, error) { +// return simulation.SimulateFromSeed( +// t, os.Stdout, newApp.BaseApp, simapp.AppStateFn(newApp.AppCodec(), newApp.SimulationManager()), +// simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 +// simapp.SimulationOperations(newApp, newApp.AppCodec(), config), +// newApp.ModuleAccountAddrs(), config, +// newApp.AppCodec(), +// ) +// } +// +// func TestFullAppSimulation(t *testing.T) { +// config, db, dir, logger, skip, err := simapp.SetupSimulation("leveldb-app-sim", "Simulation") +// if skip { +// t.Skip("skipping application simulation") +// } +// +// require.NoError(t, err, "simulation setup failed") +// +// defer func() { +// _ = db.Close() +// require.NoError(t, os.RemoveAll(dir)) +// }() +// +// app1 := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) +// require.Equal(t, "akash", app1.Name()) +// +// fmt.Printf("config-------- %v", config) +// // run randomized simulation +// _, simParams, simErr := simulateFromSeedFunc(t, app1, config) +// +// // export state and simParams before the simulation error is checked +// err = simapp.CheckExportSimulation(app1, config, simParams) +// require.NoError(t, err) +// require.NoError(t, simErr) +// +// if config.Commit { +// simapp.PrintStats(db) +// } +// } +// +// func TestAppImportExport(t *testing.T) { +// config, db, dir, logger, skip, err := simapp.SetupSimulation("leveldb-app-sim", "Simulation") +// if skip { +// t.Skip("skipping application import/export simulation") +// } +// require.NoError(t, err, "simulation setup failed") +// +// defer func() { +// db.Close() +// require.NoError(t, os.RemoveAll(dir)) +// }() +// +// app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) +// require.Equal(t, AppName, app.Name()) +// +// // Run randomized simulation +// _, simParams, simErr := simulateFromSeedFunc(t, app, config) +// +// // export state and simParams before the simulation error is checked +// err = simapp.CheckExportSimulation(app, config, simParams) +// require.NoError(t, err) +// require.NoError(t, simErr) +// +// if config.Commit { +// simapp.PrintStats(db) +// } +// +// fmt.Printf("exporting genesis...\n") +// +// exported, err := app.ExportAppStateAndValidators(false, []string{}) +// require.NoError(t, err) +// +// fmt.Printf("importing genesis...\n") +// +// _, newDB, newDir, _, _, err := simapp.SetupSimulation("leveldb-app-sim-2", "Simulation-2") +// require.NoError(t, err, "simulation setup failed") +// +// defer func() { +// newDB.Close() +// require.NoError(t, os.RemoveAll(newDir)) +// }() +// +// newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) +// require.Equal(t, AppName, newApp.Name()) +// +// var genesisState simapp.GenesisState +// err = json.Unmarshal(exported.AppState, &genesisState) +// require.NoError(t, err) +// +// ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) +// ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) +// +// newApp.MM.InitGenesis(ctxB, app.AppCodec(), genesisState) +// newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) +// +// fmt.Printf("comparing stores...\n") +// +// storeKeysPrefixes := []StoreKeysPrefixes{ +// {app.keys[authtypes.StoreKey], newApp.keys[authtypes.StoreKey], [][]byte{}}, +// { +// app.keys[stakingtypes.StoreKey], newApp.keys[stakingtypes.StoreKey], +// [][]byte{ +// stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, +// stakingtypes.HistoricalInfoKey, +// }, +// }, // ordering may change but it doesn't matter +// {app.keys[slashingtypes.StoreKey], newApp.keys[slashingtypes.StoreKey], [][]byte{}}, +// {app.keys[minttypes.StoreKey], newApp.keys[minttypes.StoreKey], [][]byte{}}, +// {app.keys[distrtypes.StoreKey], newApp.keys[distrtypes.StoreKey], [][]byte{}}, +// {app.keys[banktypes.StoreKey], newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}}, +// {app.keys[paramtypes.StoreKey], newApp.keys[paramtypes.StoreKey], [][]byte{}}, +// {app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}}, +// {app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}}, +// {app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}}, +// {app.keys[ibchost.StoreKey], newApp.keys[ibchost.StoreKey], [][]byte{}}, +// {app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}}, +// } +// +// for _, skp := range storeKeysPrefixes { +// storeA := ctxA.KVStore(skp.A) +// storeB := ctxB.KVStore(skp.B) +// +// failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) +// require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") +// +// fmt.Printf("compared %d key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) +// require.Equal(t, len(failedKVAs), 0, simapp.GetSimulationLog(skp.A.Name(), +// app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) +// } +// } +// +// func TestAppSimulationAfterImport(t *testing.T) { +// config, db, dir, logger, skip, err := simapp.SetupSimulation("leveldb-app-sim", "Simulation") +// if skip { +// t.Skip("skipping application simulation after import") +// } +// +// require.NoError(t, err, "simulation setup failed") +// +// defer func() { +// db.Close() +// require.NoError(t, os.RemoveAll(dir)) +// }() +// +// app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) +// require.Equal(t, AppName, app.Name()) +// +// // Run randomized simulation +// stopEarly, simParams, simErr := simulateFromSeedFunc(t, app, config) +// +// // export state and simParams before the simulation error is checked +// err = simapp.CheckExportSimulation(app, config, simParams) +// require.NoError(t, err) +// require.NoError(t, simErr) +// +// if config.Commit { +// simapp.PrintStats(db) +// } +// +// if stopEarly { +// fmt.Println("can't export or import a zero-validator genesis, exiting test...") +// return +// } +// +// fmt.Printf("exporting genesis...\n") +// +// exported, err := app.ExportAppStateAndValidators(true, []string{}) +// require.NoError(t, err) +// +// fmt.Printf("importing genesis...\n") +// +// _, newDB, newDir, _, val, err := simapp.SetupSimulation("leveldb-app-sim-2", "Simulation-2") +// require.NoError(t, err, "simulation setup failed", val) +// +// defer func() { +// newDB.Close() +// require.NoError(t, os.RemoveAll(newDir)) +// }() +// +// newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), fauxMerkleModeOpt) +// require.Equal(t, AppName, newApp.Name()) +// +// newApp.InitChain(abci.RequestInitChain{ +// AppStateBytes: exported.AppState, +// }) +// +// _, _, err = simulateFromSeedFunc(t, newApp, config) +// require.NoError(t, err) +// } +// +// func TestAppStateDeterminism(t *testing.T) { +// if !simapp.FlagEnabledValue { +// t.Skip("skipping application simulation") +// } +// +// config := simapp.NewConfigFromFlags() +// config.InitialBlockHeight = 1 +// config.ExportParamsPath = "" +// config.OnOperation = false +// config.AllInvariants = false +// config.ChainID = helpers.SimAppChainID +// +// numSeeds := 2 +// numTimesToRunPerSeed := 2 +// appHashList := make([]json.RawMessage, numTimesToRunPerSeed) +// +// for i := 0; i < numSeeds; i++ { +// config.Seed = rand.Int63() // nolint:gosec +// +// for j := 0; j < numTimesToRunPerSeed; j++ { +// var logger log.Logger +// if simapp.FlagVerboseValue { +// logger = log.TestingLogger() +// } else { +// logger = log.NewNopLogger() +// } +// +// db := dbm.NewMemDB() +// +// app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, map[int64]bool{}, DefaultHome, OptsWithGenesisTime(config.Seed), interBlockCacheOpt()) +// +// fmt.Printf( +// "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", +// config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, +// ) +// +// _, _, err := simulateFromSeedFunc(t, app, config) +// require.NoError(t, err) +// +// if config.Commit { +// simapp.PrintStats(db) +// } +// +// appHash := app.LastCommitID().Hash +// appHashList[j] = appHash +// +// if j != 0 { +// require.Equal( +// t, appHashList[0], appHashList[j], +// "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", +// config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, +// ) +// } +// } +// } +// } diff --git a/app/types/app.go b/app/types/app.go index bb362c9597..1e26b54269 100644 --- a/app/types/app.go +++ b/app/types/app.go @@ -4,35 +4,85 @@ import ( "errors" "fmt" "reflect" + "sync" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/params" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/cosmos-sdk/x/upgrade" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" - ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" - - akeeper "github.com/akash-network/node/x/audit/keeper" - ckeeper "github.com/akash-network/node/x/cert/keeper" - dkeeper "github.com/akash-network/node/x/deployment/keeper" - ekeeper "github.com/akash-network/node/x/escrow/keeper" - agovkeeper "github.com/akash-network/node/x/gov/keeper" - ikeeper "github.com/akash-network/node/x/inflation/keeper" - mkeeper "github.com/akash-network/node/x/market/keeper" - pkeeper "github.com/akash-network/node/x/provider/keeper" - astakingkeeper "github.com/akash-network/node/x/staking/keeper" - tkeeper "github.com/akash-network/node/x/take/keeper" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" + ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" + ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper" + auctiontypes "github.com/skip-mev/block-sdk/x/auction/types" + + appparams "pkg.akt.dev/akashd/app/params" + "pkg.akt.dev/akashd/x/audit" + akeeper "pkg.akt.dev/akashd/x/audit/keeper" + "pkg.akt.dev/akashd/x/cert" + ckeeper "pkg.akt.dev/akashd/x/cert/keeper" + "pkg.akt.dev/akashd/x/deployment" + dkeeper "pkg.akt.dev/akashd/x/deployment/keeper" + "pkg.akt.dev/akashd/x/escrow" + ekeeper "pkg.akt.dev/akashd/x/escrow/keeper" + agov "pkg.akt.dev/akashd/x/gov" + agovkeeper "pkg.akt.dev/akashd/x/gov/keeper" + "pkg.akt.dev/akashd/x/inflation" + ikeeper "pkg.akt.dev/akashd/x/inflation/keeper" + "pkg.akt.dev/akashd/x/market" + mhooks "pkg.akt.dev/akashd/x/market/hooks" + mkeeper "pkg.akt.dev/akashd/x/market/keeper" + "pkg.akt.dev/akashd/x/provider" + pkeeper "pkg.akt.dev/akashd/x/provider/keeper" + astaking "pkg.akt.dev/akashd/x/staking" + astakingkeeper "pkg.akt.dev/akashd/x/staking/keeper" + "pkg.akt.dev/akashd/x/take" + tkeeper "pkg.akt.dev/akashd/x/take/keeper" +) + +const ( + AccountAddressPrefix = "akash" ) var ErrEmptyFieldName = errors.New("empty field name") @@ -48,12 +98,13 @@ type AppKeepers struct { Slashing slashingkeeper.Keeper Mint mintkeeper.Keeper Distr distrkeeper.Keeper - Gov govkeeper.Keeper - Crisis crisiskeeper.Keeper - Upgrade upgradekeeper.Keeper + Gov *govkeeper.Keeper + Crisis *crisiskeeper.Keeper + Upgrade *upgradekeeper.Keeper Params paramskeeper.Keeper + ConsensusParams *consensusparamkeeper.Keeper IBC *ibckeeper.Keeper - Evidence evidencekeeper.Keeper + Evidence *evidencekeeper.Keeper Transfer ibctransferkeeper.Keeper ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper @@ -71,12 +122,469 @@ type AppKeepers struct { Staking astakingkeeper.IKeeper Gov agovkeeper.IKeeper } + + External struct { + Auction *auctionkeeper.Keeper + } } type App struct { Keepers AppKeepers Configurator module.Configurator MM *module.Manager + + // keys to access the substores + kOnce sync.Once + keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey + memKeys map[string]*storetypes.MemoryStoreKey +} + +func (app *App) GenerateKeys() { + // Define what keys will be used in the cosmos-sdk key/value store. + // Cosmos-SDK modules each have a "key" that allows the application to reference what they've stored on the chain. + app.kOnce.Do(func() { + app.keys = sdk.NewKVStoreKeys(kvStoreKeys()...) + + // Define transient store keys + app.tkeys = sdk.NewTransientStoreKeys(transientStoreKeys()...) + + // MemKeys are for information that is stored only in RAM. + app.memKeys = sdk.NewMemoryStoreKeys(memStoreKeys()...) + }) +} + +// GetSubspace gets existing substore from keeper. +func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.Keepers.Cosmos.Params.GetSubspace(moduleName) + return subspace +} + +// GetKVStoreKey gets KV Store keys. +func (app *App) GetKVStoreKey() map[string]*storetypes.KVStoreKey { + return app.keys +} + +// GetTransientStoreKey gets Transient Store keys. +func (app *App) GetTransientStoreKey() map[string]*storetypes.TransientStoreKey { + return app.tkeys +} + +// GetMemoryStoreKey get memory Store keys. +func (app *App) GetMemoryStoreKey() map[string]*storetypes.MemoryStoreKey { + return app.memKeys +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { + return app.keys[storeKey] +} + +// GetTKey returns the TransientStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey { + return app.tkeys[storeKey] +} + +// GetMemKey returns the MemStoreKey for the provided mem key. +// +// NOTE: This is solely used for testing purposes. +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + return app.memKeys[storeKey] +} + +// InitSpecialKeepers initiates special keepers (crisis appkeeper, upgradekeeper, params keeper) +func (app *App) InitSpecialKeepers( + appCodec codec.Codec, + cdc *codec.LegacyAmino, + bApp *baseapp.BaseApp, + invCheckPeriod uint, + skipUpgradeHeights map[int64]bool, + homePath string) { + + app.GenerateKeys() + + app.Keepers.Cosmos.Params = initParamsKeeper(appCodec, cdc, app.keys[paramstypes.StoreKey], app.keys[paramstypes.TStoreKey]) + + // set the BaseApp's parameter store + { + keeper := consensusparamkeeper.NewKeeper( + appCodec, + app.keys[consensusparamtypes.StoreKey], + authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + app.Keepers.Cosmos.ConsensusParams = &keeper + } + + bApp.SetParamStore(app.Keepers.Cosmos.ConsensusParams) + + // add capability keeper and ScopeToModule for ibc module + app.Keepers.Cosmos.Cap = capabilitykeeper.NewKeeper( + appCodec, + app.keys[capabilitytypes.StoreKey], + app.memKeys[capabilitytypes.MemStoreKey], + ) + + app.Keepers.Cosmos.ScopedIBCKeeper = app.Keepers.Cosmos.Cap.ScopeToModule(ibchost.ModuleName) + app.Keepers.Cosmos.ScopedTransferKeeper = app.Keepers.Cosmos.Cap.ScopeToModule(ibctransfertypes.ModuleName) + + // seal the capability keeper so all persistent capabilities are loaded in-memory and prevent + // any further modules from creating scoped sub-keepers. + app.Keepers.Cosmos.Cap.Seal() + + app.Keepers.Cosmos.Crisis = crisiskeeper.NewKeeper( + appCodec, + app.GetKey(crisistypes.ModuleName), + invCheckPeriod, + app.Keepers.Cosmos.Bank, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + app.Keepers.Cosmos.Upgrade = upgradekeeper.NewKeeper( + skipUpgradeHeights, + app.GetKey(upgradetypes.StoreKey), + appCodec, + homePath, + bApp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) +} + +func (app *App) InitNormalKeepers( + cdc codec.Codec, + encodingConfig appparams.EncodingConfig, + bApp *baseapp.BaseApp, + maccPerms map[string][]string, + blockedAddresses map[string]bool) { + + legacyAmino := encodingConfig.Amino + + app.Keepers.Cosmos.Acct = authkeeper.NewAccountKeeper( + cdc, + app.keys[authtypes.StoreKey], + authtypes.ProtoBaseAccount, + maccPerms, + AccountAddressPrefix, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + app.Keepers.Cosmos.Bank = bankkeeper.NewBaseKeeper( + cdc, + app.keys[banktypes.StoreKey], + app.Keepers.Cosmos.Acct, + blockedAddresses, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // add authz keeper + app.Keepers.Cosmos.Authz = authzkeeper.NewKeeper( + app.keys[authzkeeper.StoreKey], + cdc, + bApp.MsgServiceRouter(), + app.Keepers.Cosmos.Acct, + ) + + app.Keepers.Cosmos.Staking = stakingkeeper.NewKeeper( + cdc, + app.keys[stakingtypes.StoreKey], + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + app.Keepers.Cosmos.Distr = distrkeeper.NewKeeper( + cdc, + app.keys[distrtypes.StoreKey], + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Staking, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + app.Keepers.Cosmos.Slashing = slashingkeeper.NewKeeper( + cdc, + legacyAmino, + app.keys[slashingtypes.StoreKey], + app.Keepers.Cosmos.Staking, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // register IBC Keeper + app.Keepers.Cosmos.IBC = ibckeeper.NewKeeper( + cdc, + app.keys[ibchost.StoreKey], + app.GetSubspace(ibchost.ModuleName), + app.Keepers.Cosmos.Staking, + app.Keepers.Cosmos.Upgrade, + app.Keepers.Cosmos.ScopedIBCKeeper, + ) + + // create evidence keeper with evidence router + app.Keepers.Cosmos.Evidence = evidencekeeper.NewKeeper( + cdc, + app.keys[evidencetypes.StoreKey], + app.Keepers.Cosmos.Staking, + app.Keepers.Cosmos.Slashing, + ) + + app.Keepers.Cosmos.Mint = mintkeeper.NewKeeper( + cdc, + app.keys[minttypes.StoreKey], + app.Keepers.Cosmos.Staking, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + govConfig := govtypes.DefaultConfig() + // Set the maximum metadata length for government-related configurations to 10,200, deviating from the default value of 256. + govConfig.MaxMetadataLen = 10200 + + // register the proposal types + govRouter := govtypesv1.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govtypesv1.ProposalHandler). + AddRoute( + paramproposal.RouterKey, + params.NewParamChangeProposalHandler(app.Keepers.Cosmos.Params), + ). + AddRoute( + upgradetypes.RouterKey, + upgrade.NewSoftwareUpgradeProposalHandler(app.Keepers.Cosmos.Upgrade), + ). + AddRoute( + ibcclienttypes.RouterKey, + ibcclient.NewClientProposalHandler(app.Keepers.Cosmos.IBC.ClientKeeper), + ). + AddRoute( + ibchost.RouterKey, + ibcclient.NewClientProposalHandler(app.Keepers.Cosmos.IBC.ClientKeeper), + ) + + app.Keepers.Cosmos.Gov = govkeeper.NewKeeper( + cdc, + app.keys[govtypes.StoreKey], + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Staking, + bApp.MsgServiceRouter(), + govConfig, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + app.Keepers.Cosmos.Gov.SetLegacyRouter(govRouter) + + app.Keepers.Cosmos.FeeGrant = feegrantkeeper.NewKeeper( + cdc, + app.keys[feegrant.StoreKey], + app.Keepers.Cosmos.Acct, + ) + + // register Transfer Keepers + app.Keepers.Cosmos.Transfer = ibctransferkeeper.NewKeeper( + cdc, + app.keys[ibctransfertypes.StoreKey], + app.GetSubspace(ibctransfertypes.ModuleName), + app.Keepers.Cosmos.IBC.ChannelKeeper, + app.Keepers.Cosmos.IBC.ChannelKeeper, + &app.Keepers.Cosmos.IBC.PortKeeper, + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.ScopedIBCKeeper) + + transferIBCModule := transfer.NewIBCModule(app.Keepers.Cosmos.Transfer) + + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := porttypes.NewRouter() + ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule) + + app.Keepers.Cosmos.IBC.SetRouter(ibcRouter) + + // initialize the auction keeper + { + + auctionKeeper := auctionkeeper.NewKeeper( + cdc, + app.keys[auctiontypes.StoreKey], + app.Keepers.Cosmos.Acct, + app.Keepers.Cosmos.Bank, + app.Keepers.Cosmos.Distr, + app.Keepers.Cosmos.Staking, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + app.Keepers.External.Auction = &auctionKeeper + } + + app.Keepers.Akash.Take = tkeeper.NewKeeper( + cdc, + app.keys[take.StoreKey], + app.GetSubspace(take.ModuleName), + ) + + app.Keepers.Akash.Escrow = ekeeper.NewKeeper( + cdc, + app.keys[escrow.StoreKey], + app.Keepers.Cosmos.Bank, + app.Keepers.Akash.Take, + app.Keepers.Cosmos.Distr, + app.Keepers.Cosmos.Authz, + ) + + app.Keepers.Akash.Deployment = deployment.NewKeeper( + cdc, + app.keys[deployment.StoreKey], + app.GetSubspace(deployment.ModuleName), + app.Keepers.Akash.Escrow, + ) + + app.Keepers.Akash.Market = market.NewKeeper( + cdc, + app.keys[market.StoreKey], + app.GetSubspace(market.ModuleName), + app.Keepers.Akash.Escrow, + ) + + app.Keepers.Akash.Provider = provider.NewKeeper( + cdc, + app.keys[provider.StoreKey], + ) + + app.Keepers.Akash.Audit = akeeper.NewKeeper( + cdc, + app.keys[audit.StoreKey], + ) + + app.Keepers.Akash.Cert = ckeeper.NewKeeper( + cdc, + app.keys[cert.StoreKey], + ) + + app.Keepers.Akash.Inflation = ikeeper.NewKeeper( + cdc, + app.keys[inflation.StoreKey], + app.GetSubspace(inflation.ModuleName), + ) + + app.Keepers.Akash.Staking = astakingkeeper.NewKeeper( + cdc, + app.keys[astaking.StoreKey], + app.GetSubspace(astaking.ModuleName), + ) + + app.Keepers.Akash.Gov = agovkeeper.NewKeeper( + cdc, + app.keys[agov.StoreKey], + app.GetSubspace(agov.ModuleName), + ) +} + +func (app *App) SetupHooks() { + // register the staking hooks + app.Keepers.Cosmos.Staking.SetHooks( + stakingtypes.NewMultiStakingHooks( + app.Keepers.Cosmos.Distr.Hooks(), + app.Keepers.Cosmos.Slashing.Hooks(), + ), + ) + + app.Keepers.Cosmos.Gov.SetHooks( + govtypes.NewMultiGovHooks( + // insert governance hooks receivers here + ), + ) + + hook := mhooks.New( + app.Keepers.Akash.Deployment, + app.Keepers.Akash.Market, + ) + + app.Keepers.Akash.Escrow.AddOnAccountClosedHook(hook.OnEscrowAccountClosed) + app.Keepers.Akash.Escrow.AddOnPaymentClosedHook(hook.OnEscrowPaymentClosed) +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + paramsKeeper.Subspace(authtypes.ModuleName) + paramsKeeper.Subspace(banktypes.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) + paramsKeeper.Subspace(distrtypes.ModuleName) + paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(govtypes.ModuleName) + paramsKeeper.Subspace(crisistypes.ModuleName) + paramsKeeper.Subspace(ibctransfertypes.ModuleName) + paramsKeeper.Subspace(ibchost.ModuleName) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName) + paramsKeeper.Subspace(icahosttypes.SubModuleName) + + // akash params subspaces + paramsKeeper.Subspace(deployment.ModuleName) + paramsKeeper.Subspace(market.ModuleName) + paramsKeeper.Subspace(inflation.ModuleName) + paramsKeeper.Subspace(astaking.ModuleName) + paramsKeeper.Subspace(agov.ModuleName) + paramsKeeper.Subspace(take.ModuleName) + + return paramsKeeper +} + +func kvStoreKeys() []string { + keys := []string{ + authtypes.StoreKey, + feegrant.StoreKey, + authzkeeper.StoreKey, + banktypes.StoreKey, + stakingtypes.StoreKey, + minttypes.StoreKey, + distrtypes.StoreKey, + slashingtypes.StoreKey, + govtypes.StoreKey, + paramstypes.StoreKey, + ibchost.StoreKey, + upgradetypes.StoreKey, + evidencetypes.StoreKey, + ibctransfertypes.StoreKey, + capabilitytypes.StoreKey, + auctiontypes.StoreKey, + } + + keys = append(keys, akashKVStoreKeys()..., + ) + return keys +} + +func akashKVStoreKeys() []string { + return []string{ + take.StoreKey, + escrow.StoreKey, + deployment.StoreKey, + market.StoreKey, + provider.StoreKey, + audit.StoreKey, + cert.StoreKey, + inflation.StoreKey, + astaking.StoreKey, + agov.StoreKey, + } +} + +func transientStoreKeys() []string { + return []string{ + paramstypes.TStoreKey, + } +} + +func memStoreKeys() []string { + return []string{ + capabilitytypes.MemStoreKey, + } } // FindStructField if an interface is either a struct or a pointer to a struct diff --git a/app/upgrades.go b/app/upgrades.go index de636c080b..80ec8ed818 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -5,9 +5,9 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - utypes "github.com/akash-network/node/upgrades/types" + utypes "pkg.akt.dev/akashd/upgrades/types" // nolint: revive - _ "github.com/akash-network/node/upgrades" + _ "pkg.akt.dev/akashd/upgrades" ) func (app *AkashApp) registerUpgradeHandlers() error { @@ -16,17 +16,30 @@ func (app *AkashApp) registerUpgradeHandlers() error { return err } + if app.Keepers.Cosmos.Upgrade.IsSkipHeight(upgradeInfo.Height) { + return nil + } + + currentHeight := app.CommitMultiStore().LastCommitID().Version + + if upgradeInfo.Height == currentHeight+1 { + // app.customPreUpgradeHandler(upgradeInfo) + } + for name, fn := range utypes.GetUpgradesList() { - app.Logger().Info(fmt.Sprintf("initializing upgrade `%s`", name)) + app.Logger().Info(fmt.Sprintf("configuring upgrade `%s`", name)) upgrade, err := fn(app.Logger(), &app.App) if err != nil { return fmt.Errorf("unable to unitialize upgrade `%s`: %w", name, err) } app.Keepers.Cosmos.Upgrade.SetUpgradeHandler(name, upgrade.UpgradeHandler()) - if storeUpgrades := upgrade.StoreLoader(); storeUpgrades != nil && upgradeInfo.Name == name { - app.Logger().Info(fmt.Sprintf("applying store upgrades for `%s`", name)) - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades)) + + if upgradeInfo.Name == name { + if storeUpgrades := upgrade.StoreLoader(); storeUpgrades != nil && upgradeInfo.Name == name { + app.Logger().Info(fmt.Sprintf("setting up store upgrades for `%s`", name)) + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades)) + } } } diff --git a/client/client.go b/client/client.go index 19032bb79a..441d3fae29 100644 --- a/client/client.go +++ b/client/client.go @@ -8,23 +8,23 @@ import ( sdkclient "github.com/cosmos/cosmos-sdk/client" - cmtrpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types" + cmtrpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" - aclient "github.com/akash-network/akash-api/go/node/client" - cltypes "github.com/akash-network/akash-api/go/node/client/types" - "github.com/akash-network/akash-api/go/node/client/v1beta2" + aclient "pkg.akt.dev/go/node/client" + cltypes "pkg.akt.dev/go/node/client/types" + "pkg.akt.dev/go/node/client/v1beta3" ) var ( ErrInvalidClient = errors.New("invalid client") ) -func DiscoverQueryClient(ctx context.Context, cctx sdkclient.Context) (v1beta2.QueryClient, error) { - var cl v1beta2.QueryClient +func DiscoverQueryClient(ctx context.Context, cctx sdkclient.Context) (v1beta3.QueryClient, error) { + var cl v1beta3.QueryClient err := aclient.DiscoverQueryClient(ctx, cctx, func(i interface{}) error { var valid bool - if cl, valid = i.(v1beta2.QueryClient); !valid { + if cl, valid = i.(v1beta3.QueryClient); !valid { return fmt.Errorf("%w: expected %s, actual %s", ErrInvalidClient, reflect.TypeOf(cl), reflect.TypeOf(i)) } @@ -38,13 +38,13 @@ func DiscoverQueryClient(ctx context.Context, cctx sdkclient.Context) (v1beta2.Q return cl, nil } -func DiscoverClient(ctx context.Context, cctx sdkclient.Context, opts ...cltypes.ClientOption) (v1beta2.Client, error) { - var cl v1beta2.Client +func DiscoverClient(ctx context.Context, cctx sdkclient.Context, opts ...cltypes.ClientOption) (v1beta3.Client, error) { + var cl v1beta3.Client setupFn := func(i interface{}) error { var valid bool - if cl, valid = i.(v1beta2.Client); !valid { + if cl, valid = i.(v1beta3.Client); !valid { return fmt.Errorf("%w: expected %s, actual %s", ErrInvalidClient, reflect.TypeOf(cl), reflect.TypeOf(i)) } diff --git a/cmd/akash/cmd/bech32.go b/cmd/akash/cmd/bech32.go index 50aae0d92f..b33fdafeee 100644 --- a/cmd/akash/cmd/bech32.go +++ b/cmd/akash/cmd/bech32.go @@ -1,9 +1,9 @@ package cmd import ( - "github.com/akash-network/akash-api/go/sdkutil" "github.com/cosmos/cosmos-sdk/types/bech32" "github.com/spf13/cobra" + "pkg.akt.dev/go/sdkutil" ) var flagBech32Prefix = "prefix" diff --git a/cmd/akash/cmd/flag_test.go b/cmd/akash/cmd/flag_test.go index 220283ded1..7ad31afc9b 100644 --- a/cmd/akash/cmd/flag_test.go +++ b/cmd/akash/cmd/flag_test.go @@ -6,15 +6,15 @@ import ( "os" "testing" + tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" "github.com/stretchr/testify/require" - tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/akash-network/node/app" - "github.com/akash-network/node/testutil" - testutilcli "github.com/akash-network/node/testutil/cli" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/testutil" + testutilcli "pkg.akt.dev/akashd/testutil/cli" ) // TestContextFlags tests that all the flags which are set in client.Context are parsed correctly. diff --git a/cmd/akash/cmd/root.go b/cmd/akash/cmd/root.go index 3971f12a57..d1dc07c90c 100644 --- a/cmd/akash/cmd/root.go +++ b/cmd/akash/cmd/root.go @@ -4,18 +4,18 @@ import ( "context" "io" "os" - "path/filepath" "github.com/rs/zerolog" "github.com/spf13/cast" "github.com/spf13/cobra" + // "pkg.akt.dev/go/cli" - cmtcfg "github.com/tendermint/tendermint/config" - cmtcli "github.com/tendermint/tendermint/libs/cli" - cmtlog "github.com/tendermint/tendermint/libs/log" - cmtrpc "github.com/tendermint/tendermint/rpc/core" - cmtrpcsrv "github.com/tendermint/tendermint/rpc/jsonrpc/server" - dbm "github.com/tendermint/tm-db" + dbm "github.com/cometbft/cometbft-db" + cmtcfg "github.com/cometbft/cometbft/config" + cmtcli "github.com/cometbft/cometbft/libs/cli" + cmtlog "github.com/cometbft/cometbft/libs/log" + cmtrpc "github.com/cometbft/cometbft/rpc/core" + cmtrpcsrv "github.com/cometbft/cometbft/rpc/jsonrpc/server" "github.com/cosmos/cosmos-sdk/baseapp" sdkclient "github.com/cosmos/cosmos-sdk/client" @@ -25,8 +25,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/rpc" sdkserver "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/cosmos/cosmos-sdk/snapshots" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" @@ -37,12 +35,13 @@ import ( "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - "github.com/akash-network/node/app" - "github.com/akash-network/node/client" - "github.com/akash-network/node/cmd/akash/cmd/testnetify" - ecmd "github.com/akash-network/node/events/cmd" - utilcli "github.com/akash-network/node/util/cli" - "github.com/akash-network/node/util/server" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/app/params" + "pkg.akt.dev/akashd/client" + "pkg.akt.dev/akashd/cmd/akash/cmd/testnetify" + ecmd "pkg.akt.dev/akashd/events/cmd" + utilcli "pkg.akt.dev/akashd/util/cli" + "pkg.akt.dev/akashd/util/server" ) // NewRootCmd creates a new root command for akash. It is called once in the @@ -80,7 +79,7 @@ func GetPersistentPreRunE(encodingConfig params.EncodingConfig, envPrefixes []st WithLegacyAmino(encodingConfig.Amino). WithInput(os.Stdin). WithAccountRetriever(authtypes.AccountRetriever{}). - WithBroadcastMode(flags.BroadcastBlock). + WithBroadcastMode(cli.BroadcastBlock). WithHomeDir(app.DefaultHome) if err := sdkclient.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { @@ -113,7 +112,7 @@ func Execute(rootCmd *cobra.Command, envPrefix string) error { return executor.ExecuteContext(ctx) } -// Execute executes the root command. +// ExecuteWithCtx executes the root command. func ExecuteWithCtx(ctx context.Context, rootCmd *cobra.Command, envPrefix string) error { // Create and set a client.Context on the command's Context. During the pre-run // of the root command, a default initialized client.Context is provided to @@ -126,10 +125,10 @@ func ExecuteWithCtx(ctx context.Context, rootCmd *cobra.Command, envPrefix strin ctx = context.WithValue(ctx, sdkclient.ClientContextKey, &sdkclient.Context{}) ctx = context.WithValue(ctx, sdkserver.ServerContextKey, srvCtx) - rootCmd.PersistentFlags().String(flags.FlagLogLevel, zerolog.InfoLevel.String(), "The logging level (trace|debug|info|warn|error|fatal|panic)") - rootCmd.PersistentFlags().String(flags.FlagLogFormat, cmtcfg.LogFormatPlain, "The logging format (json|plain)") - rootCmd.PersistentFlags().Bool(utilcli.FlagLogColor, false, "Pretty logging output. Applied only when log_format=plain") - rootCmd.PersistentFlags().String(utilcli.FlagLogTimestamp, "", "Add timestamp prefix to the logs (rfc3339|rfc3339nano|kitchen)") + rootCmd.PersistentFlags().String(cli.FlagLogLevel, zerolog.InfoLevel.String(), "The logging level (trace|debug|info|warn|error|fatal|panic)") + rootCmd.PersistentFlags().String(cli.FlagLogFormat, cmtcfg.LogFormatPlain, "The logging format (json|plain)") + rootCmd.PersistentFlags().Bool(cli.FlagLogColor, false, "Pretty logging output. Applied only when log_format=plain") + rootCmd.PersistentFlags().String(cli.FlagLogTimestamp, "", "Add timestamp prefix to the logs (rfc3339|rfc3339nano|kitchen)") executor := cmtcli.PrepareBaseCmd(rootCmd, envPrefix, app.DefaultHome) return executor.ExecuteContext(ctx) @@ -143,8 +142,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand( rpc.StatusCommand(), ecmd.EventCmd(), - QueryCmd(), - TxCmd(), + cli.QueryCmd(), + cli.TxCmd(), keys.Commands(app.DefaultHome), genutilcli.InitCmd(app.ModuleBasics(), app.DefaultHome), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultHome), @@ -154,7 +153,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { AddGenesisAccountCmd(app.DefaultHome), cmtcli.NewCompletionCmd(rootCmd, true), debugCmd, - sdkserver.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler), + // sdkserver.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler), ) rootCmd.AddCommand(server.Commands(app.DefaultHome, newApp, createAppAndExport, addModuleInitFlags)...) @@ -184,15 +183,15 @@ func newApp(logger cmtlog.Logger, db dbm.DB, traceStore io.Writer, appOpts serve panic(err) } - snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") - snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) - if err != nil { - panic(err) - } - snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) - if err != nil { - panic(err) - } + // snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") + // snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) + // if err != nil { + // panic(err) + // } + // snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) + // if err != nil { + // panic(err) + // } return app.NewApp( logger, db, traceStore, true, cast.ToUint(appOpts.Get(sdkserver.FlagInvCheckPeriod)), skipUpgradeHeights, @@ -206,9 +205,9 @@ func newApp(logger cmtlog.Logger, db dbm.DB, traceStore io.Writer, appOpts serve baseapp.SetInterBlockCache(cache), baseapp.SetTrace(cast.ToBool(appOpts.Get(sdkserver.FlagTrace))), baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(sdkserver.FlagIndexEvents))), - baseapp.SetSnapshotStore(snapshotStore), - baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(sdkserver.FlagStateSyncSnapshotInterval))), - baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent))), + // baseapp.SetSnapshotStore(snapshotStore), + // baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(sdkserver.FlagStateSyncSnapshotInterval))), + // baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent))), ) } @@ -233,7 +232,7 @@ func createAppAndExport( akashApp = app.NewApp(logger, db, tio, true, uint(1), map[int64]bool{}, "", appOpts) } - return akashApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs) + return akashApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, akashApp.MM.ModuleNames()) } func QueryCmd() *cobra.Command { diff --git a/cmd/akash/cmd/testnetify/cmd.go b/cmd/akash/cmd/testnetify/cmd.go index 4bf8820e3a..4cfd6865e1 100644 --- a/cmd/akash/cmd/testnetify/cmd.go +++ b/cmd/akash/cmd/testnetify/cmd.go @@ -10,14 +10,14 @@ import ( "github.com/spf13/cobra" "github.com/theckman/yacspin" - cmtjson "github.com/tendermint/tendermint/libs/json" - tmtypes "github.com/tendermint/tendermint/types" + cmtjson "github.com/cometbft/cometbft/libs/json" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - ibccltypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" - ibcchtypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" + ibccltypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + ibcchtypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" ) const ( @@ -300,7 +300,7 @@ func (ga *GenesisState) modifyGov(cdc codec.Codec, cfg *GovConfig) error { if params := cfg.VotingParams; params != nil { if params.VotingPeriod.Duration > 0 { - ga.app.GovState.state.VotingParams.VotingPeriod = params.VotingPeriod.Duration + ga.app.GovState.state.Params.VotingPeriod = ¶ms.VotingPeriod.Duration } } diff --git a/cmd/akash/cmd/testnetify/escrow.go b/cmd/akash/cmd/testnetify/escrow.go index c24ce32bab..7f60792653 100644 --- a/cmd/akash/cmd/testnetify/escrow.go +++ b/cmd/akash/cmd/testnetify/escrow.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + etypes "pkg.akt.dev/go/node/escrow/v1" ) func (ga *GenesisState) modifyEscrowState(cdc codec.Codec, cfg *EscrowConfig) error { diff --git a/cmd/akash/cmd/testnetify/state.go b/cmd/akash/cmd/testnetify/state.go index 8d5245ae71..3894af25ac 100644 --- a/cmd/akash/cmd/testnetify/state.go +++ b/cmd/akash/cmd/testnetify/state.go @@ -7,10 +7,9 @@ import ( "sync" "time" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" "github.com/theckman/yacspin" - tmtypes "github.com/tendermint/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -20,24 +19,27 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + gov "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" - ibccoretypes "github.com/cosmos/ibc-go/v4/modules/core/types" - - atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" - ctypes "github.com/akash-network/akash-api/go/node/cert/v1beta3" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" - - "github.com/akash-network/node/x/audit" - "github.com/akash-network/node/x/cert" - "github.com/akash-network/node/x/deployment" - "github.com/akash-network/node/x/escrow" - "github.com/akash-network/node/x/market" - "github.com/akash-network/node/x/provider" + ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibccoretypes "github.com/cosmos/ibc-go/v7/modules/core/types" + + atypes "pkg.akt.dev/go/node/audit/v1" + ctypes "pkg.akt.dev/go/node/cert/v1" + dv1 "pkg.akt.dev/go/node/deployment/v1" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + etypes "pkg.akt.dev/go/node/escrow/v1" + mtypes "pkg.akt.dev/go/node/market/v1beta5" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" + + "pkg.akt.dev/akashd/x/audit" + "pkg.akt.dev/akashd/x/cert" + "pkg.akt.dev/akashd/x/deployment" + "pkg.akt.dev/akashd/x/escrow" + "pkg.akt.dev/akashd/x/market" + "pkg.akt.dev/akashd/x/provider" ) type ( @@ -451,16 +453,10 @@ func (ga *AuthState) pack(cdc codec.Codec) error { } func (ga *BankState) unpack(cdc codec.Codec) error { - var err error - ga.once.Do(func() { ga.state = banktypes.GetGenesisStateFromAppState(cdc, ga.gstate) }) - if err != nil { - return err - } - return nil } @@ -482,16 +478,10 @@ func (ga *BankState) pack(cdc codec.Codec) error { } func (ga *GovState) unpack(cdc codec.Codec) error { - var err error - ga.once.Do(func() { ga.state = GetGovGenesisStateFromAppState(cdc, ga.gstate) }) - if err != nil { - return err - } - return nil } @@ -502,7 +492,7 @@ func (ga *GovState) pack(cdc codec.Codec) error { return fmt.Errorf("failed to marshal gov genesis state: %s", err.Error()) // nolint: goerr113 } - ga.gstate[govtypes.ModuleName] = stateBz + ga.gstate[gov.ModuleName] = stateBz ga.once = sync.Once{} } @@ -511,16 +501,10 @@ func (ga *GovState) pack(cdc codec.Codec) error { } func (ga *IBCState) unpack(cdc codec.Codec) error { - var err error - ga.once.Do(func() { ga.state = GetIBCGenesisStateFromAppState(cdc, ga.gstate) }) - if err != nil { - return err - } - return nil } @@ -540,16 +524,10 @@ func (ga *IBCState) pack(cdc codec.Codec) error { } func (ga *StakingState) unpack(cdc codec.Codec) error { - var err error - ga.once.Do(func() { ga.state = stakingtypes.GetGenesisStateFromAppState(cdc, ga.gstate) }) - if err != nil { - return err - } - return nil } @@ -569,16 +547,10 @@ func (ga *StakingState) pack(cdc codec.Codec) error { } func (ga *SlashingState) unpack(cdc codec.Codec) error { - var err error - ga.once.Do(func() { ga.state = GetSlashingGenesisStateFromAppState(cdc, ga.gstate) }) - if err != nil { - return err - } - return nil } @@ -598,16 +570,10 @@ func (ga *SlashingState) pack(cdc codec.Codec) error { } func (ga *DistributionState) unpack(cdc codec.Codec) error { - var err error - ga.once.Do(func() { ga.state = GetDistributionGenesisStateFromAppState(cdc, ga.gstate) }) - if err != nil { - return err - } - return nil } @@ -690,7 +656,7 @@ func (ga *DeploymentState) pack(cdc codec.Codec) error { return fmt.Errorf("failed to marshal deployment genesis state: %s", err.Error()) // nolint: goerr113 } - ga.gstate[dtypes.ModuleName] = stateBz + ga.gstate[dv1.ModuleName] = stateBz ga.once = sync.Once{} } @@ -994,7 +960,7 @@ func (ga *GenesisState) IncreaseDelegatorStake( stake := sdk.NewDec(0) for _, coin := range coins { - stake = stake.Add(coin.Amount.ToDec()) + stake = stake.Add(coin.Amount.ToLegacyDec()) *sVal, _ = sVal.AddTokensFromDel(coin.Amount) } diff --git a/cmd/akash/cmd/testnetify/util.go b/cmd/akash/cmd/testnetify/util.go index 12c2a6a246..4ee0c9aa76 100644 --- a/cmd/akash/cmd/testnetify/util.go +++ b/cmd/akash/cmd/testnetify/util.go @@ -5,10 +5,11 @@ import ( "github.com/cosmos/cosmos-sdk/codec" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + gov "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" - ibccoretypes "github.com/cosmos/ibc-go/v4/modules/core/types" + ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibccoretypes "github.com/cosmos/ibc-go/v7/modules/core/types" ) func GetIBCGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *ibccoretypes.GenesisState { @@ -24,8 +25,8 @@ func GetIBCGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]jso func GetGovGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *govtypes.GenesisState { var genesisState govtypes.GenesisState - if appState[govtypes.ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[govtypes.ModuleName], &genesisState) + if appState[gov.ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[gov.ModuleName], &genesisState) } return &genesisState diff --git a/cmd/akash/main.go b/cmd/akash/main.go index 9945ee52a6..3d35f64acb 100644 --- a/cmd/akash/main.go +++ b/cmd/akash/main.go @@ -5,9 +5,9 @@ import ( "github.com/cosmos/cosmos-sdk/server" - _ "github.com/akash-network/akash-api/go/sdkutil" + _ "pkg.akt.dev/go/sdkutil" - "github.com/akash-network/node/cmd/akash/cmd" + "pkg.akt.dev/akashd/cmd/akash/cmd" ) // In main we call the rootCmd diff --git a/cmd/common/flags.go b/cmd/common/flags.go index ca321459f8..dc40065829 100644 --- a/cmd/common/flags.go +++ b/cmd/common/flags.go @@ -6,12 +6,13 @@ import ( "errors" "fmt" - "github.com/akash-network/akash-api/go/node/client/v1beta2" - "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/spf13/cobra" "github.com/spf13/pflag" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + + client "pkg.akt.dev/go/node/client/v1beta3" ) const ( @@ -33,7 +34,7 @@ func AddDepositFlags(flags *pflag.FlagSet) { flags.String(FlagDeposit, "", "Deposit amount") } -func DetectDeposit(ctx context.Context, flags *pflag.FlagSet, cl v1beta2.QueryClient, subspace, paramKey string) (sdk.Coin, error) { +func DetectDeposit(ctx context.Context, flags *pflag.FlagSet, cl client.QueryClient, subspace, paramKey string) (sdk.Coin, error) { var deposit sdk.Coin var depositStr string var err error diff --git a/events/cmd/root.go b/events/cmd/root.go index 81c1f9c8dc..9e4497c990 100644 --- a/events/cmd/root.go +++ b/events/cmd/root.go @@ -5,16 +5,15 @@ import ( "errors" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" + "pkg.akt.dev/go/cli" "github.com/spf13/cobra" "github.com/spf13/viper" "golang.org/x/sync/errgroup" - "github.com/akash-network/node/cmd/common" - cmdcommon "github.com/akash-network/node/cmd/common" - "github.com/akash-network/node/events" - "github.com/akash-network/node/pubsub" + "pkg.akt.dev/akashd/cmd/common" + cmdcommon "pkg.akt.dev/akashd/cmd/common" + "pkg.akt.dev/akashd/pubsub" ) // EventCmd prints out events in real time @@ -29,8 +28,8 @@ func EventCmd() *cobra.Command { }, } - cmd.Flags().String(flags.FlagNode, "tcp://localhost:26657", "The node address") - if err := viper.BindPFlag(flags.FlagNode, cmd.Flags().Lookup(flags.FlagNode)); err != nil { + cmd.Flags().String(cli.FlagNode, "tcp://localhost:26657", "The node address") + if err := viper.BindPFlag(cli.FlagNode, cmd.Flags().Lookup(cli.FlagNode)); err != nil { return nil } @@ -40,10 +39,12 @@ func EventCmd() *cobra.Command { func getEvents(ctx context.Context, cmd *cobra.Command, _ []string) error { cctx := client.GetClientContextFromCmd(cmd) - if err := cctx.Client.Start(); err != nil { - return err - } + // node, err := cctx.GetNode() + // if err != nil { + // return err + // } + // node. bus := pubsub.NewBus() defer bus.Close() @@ -55,9 +56,9 @@ func getEvents(ctx context.Context, cmd *cobra.Command, _ []string) error { return err } - group.Go(func() error { - return events.Publish(ctx, cctx.Client, "akash-cli", bus) - }) + // group.Go(func() error { + // return events.Publish(ctx, node, "akash-cli", bus) + // }) group.Go(func() error { for { diff --git a/events/publish.go b/events/publish.go index a39f7b3e6c..226e2a6ea1 100644 --- a/events/publish.go +++ b/events/publish.go @@ -3,49 +3,41 @@ package events import ( "context" + "github.com/cosmos/gogoproto/proto" "golang.org/x/sync/errgroup" + atypes "pkg.akt.dev/go/node/audit/v1" + dtypes "pkg.akt.dev/go/node/deployment/v1" + mtypes "pkg.akt.dev/go/node/market/v1" - sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - tmclient "github.com/tendermint/tendermint/rpc/client" - ctypes "github.com/tendermint/tendermint/rpc/core/types" - tmtmtypes "github.com/tendermint/tendermint/types" + abcitypes "github.com/cometbft/cometbft/abci/types" + cmclient "github.com/cometbft/cometbft/rpc/client" + ctypes "github.com/cometbft/cometbft/rpc/core/types" + cmtypes "github.com/cometbft/cometbft/types" + sdktypes "github.com/cosmos/cosmos-sdk/types" - atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - "github.com/akash-network/akash-api/go/sdkutil" - - "github.com/akash-network/node/pubsub" + "pkg.akt.dev/akashd/pubsub" ) -// Publish events using tm buses to clients. Waits on context -// shutdown signals to exit. -func Publish(ctx context.Context, tmbus tmclient.EventsClient, name string, bus pubsub.Bus) (err error) { - - const ( - queuesz = 100 - ) - var ( - txname = name + "-tx" - blkname = name + "-blk" - ) +// Publish events using cometbft buses to clients. Waits on context +func Publish(ctx context.Context, evbus cmclient.EventsClient, name string, bus pubsub.Bus) (err error) { + const queuesz = 100 + var txname = name + "-tx" + var blkname = name + "-blk" - txch, err := tmbus.Subscribe(ctx, txname, txQuery().String(), queuesz) + txch, err := evbus.Subscribe(ctx, txname, txQuery().String(), queuesz) if err != nil { return err } defer func() { - err = tmbus.UnsubscribeAll(ctx, txname) + err = evbus.UnsubscribeAll(ctx, txname) }() - blkch, err := tmbus.Subscribe(ctx, blkname, blkQuery().String(), queuesz) + blkch, err := evbus.Subscribe(ctx, blkname, blkQuery().String(), queuesz) if err != nil { return err } defer func() { - err = tmbus.UnsubscribeAll(ctx, blkname) + err = evbus.UnsubscribeAll(ctx, blkname) }() g, ctx := errgroup.WithContext(ctx) @@ -62,6 +54,8 @@ func Publish(ctx context.Context, tmbus tmclient.EventsClient, name string, bus } func publishEvents(ctx context.Context, ch <-chan ctypes.ResultEvent, bus pubsub.Bus) error { + defer bus.Close() + var err error loop: @@ -71,13 +65,18 @@ loop: break loop case ed := <-ch: switch evt := ed.Data.(type) { - case tmtmtypes.EventDataTx: + case cmtypes.EventDataTx: if !evt.Result.IsOK() { continue } - processEvents(bus, evt.Result.GetEvents()) - case tmtmtypes.EventDataNewBlockHeader: - processEvents(bus, evt.ResultEndBlock.GetEvents()) + + if err = processEvents(bus, evt.Result.GetEvents()); err != nil { + return err + } + case cmtypes.EventDataNewBlockHeader: + if err = processEvents(bus, evt.ResultEndBlock.GetEvents()); err != nil { + return err + } } } } @@ -85,39 +84,44 @@ loop: return err } -func processEvents(bus pubsub.Bus, events []abci.Event) { +func processEvents(bus pubsub.Bus, events []abcitypes.Event) error { for _, ev := range events { - if mev, ok := processEvent(ev); ok { - if err := bus.Publish(mev); err != nil { - bus.Close() - return - } + evt, err := sdktypes.ParseTypedEvent(ev) + if err != nil { continue } - } -} -func processEvent(bev abci.Event) (interface{}, bool) { - ev, err := sdkutil.ParseEvent(sdk.StringifyEvent(bev)) - if err != nil { - return nil, false - } - - if mev, err := dtypes.ParseEvent(ev); err == nil { - return mev, true - } + if evt = filterEvent(evt); evt == nil { + continue + } - if mev, err := mtypes.ParseEvent(ev); err == nil { - return mev, true + if err := bus.Publish(evt); err != nil { + return err + } } - if mev, err := ptypes.ParseEvent(ev); err == nil { - return mev, true - } + return nil +} - if mev, err := atypes.ParseEvent(ev); err == nil { - return mev, true +func filterEvent(bev proto.Message) proto.Message { + switch bev.(type) { + case *atypes.EventTrustedAuditorCreated: + case *atypes.EventTrustedAuditorDeleted: + case *dtypes.EventDeploymentCreated: + case *dtypes.EventDeploymentUpdated: + case *dtypes.EventDeploymentClosed: + case *dtypes.EventGroupStarted: + case *dtypes.EventGroupPaused: + case *dtypes.EventGroupClosed: + case *mtypes.EventOrderCreated: + case *mtypes.EventOrderClosed: + case *mtypes.EventBidCreated: + case *mtypes.EventBidClosed: + case *mtypes.EventLeaseCreated: + case *mtypes.EventLeaseClosed: + default: + return nil } - return nil, false + return bev } diff --git a/events/publish_test.go b/events/publish_test.go index 8b480b1d9b..456b361615 100644 --- a/events/publish_test.go +++ b/events/publish_test.go @@ -1,50 +1,50 @@ package events -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - "github.com/akash-network/akash-api/go/sdkutil" - - "github.com/akash-network/node/testutil" -) - -func Test_processEvent(t *testing.T) { - tests := []sdkutil.ModuleEvent{ - // x/deployment events - dtypes.NewEventDeploymentCreated(testutil.DeploymentID(t), testutil.DeploymentVersion(t)), - dtypes.NewEventDeploymentUpdated(testutil.DeploymentID(t), testutil.DeploymentVersion(t)), - dtypes.NewEventDeploymentClosed(testutil.DeploymentID(t)), - dtypes.NewEventGroupClosed(testutil.GroupID(t)), - - // x/market events - mtypes.NewEventOrderCreated(testutil.OrderID(t)), - mtypes.NewEventOrderClosed(testutil.OrderID(t)), - mtypes.NewEventBidCreated(testutil.BidID(t), testutil.DecCoin(t)), - mtypes.NewEventBidClosed(testutil.BidID(t), testutil.DecCoin(t)), - mtypes.NewEventLeaseCreated(testutil.LeaseID(t), testutil.DecCoin(t)), - mtypes.NewEventLeaseClosed(testutil.LeaseID(t), testutil.DecCoin(t)), - - // x/provider events - ptypes.NewEventProviderCreated(testutil.AccAddress(t)), - ptypes.NewEventProviderUpdated(testutil.AccAddress(t)), - ptypes.NewEventProviderDeleted(testutil.AccAddress(t)), - } - - for _, test := range tests { - sdkevs := sdk.Events{ - test.ToSDKEvent(), - }.ToABCIEvents() - - sdkev := sdkevs[0] - - ev, ok := processEvent(sdkev) - assert.True(t, ok, test) - assert.Equal(t, test, ev, test) - } -} +// import ( +// "testing" +// +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/stretchr/testify/assert" +// +// dtypes "pkg.akt.dev/go/node/deployment/v1" +// mtypes "pkg.akt.dev/go/node/market/v1beta5" +// ptypes "pkg.akt.dev/go/node/provider/v1beta4" +// "pkg.akt.dev/go/sdkutil" +// +// "pkg.akt.dev/akashd/testutil" +// ) +// +// func Test_processEvent(t *testing.T) { +// tests := []sdkutil.ModuleEvent{ +// // x/deployment events +// dtypes.NewEventDeploymentCreated(testutil.DeploymentID(t), testutil.DeploymentVersion(t)), +// dtypes.NewEventDeploymentUpdated(testutil.DeploymentID(t), testutil.DeploymentVersion(t)), +// dtypes.NewEventDeploymentClosed(testutil.DeploymentID(t)), +// dtypes.NewEventGroupClosed(testutil.GroupID(t)), +// +// // x/market events +// mtypes.NewEventOrderCreated(testutil.OrderID(t)), +// mtypes.NewEventOrderClosed(testutil.OrderID(t)), +// mtypes.NewEventBidCreated(testutil.BidID(t), testutil.DecCoin(t)), +// mtypes.NewEventBidClosed(testutil.BidID(t), testutil.DecCoin(t)), +// mtypes.NewEventLeaseCreated(testutil.LeaseID(t), testutil.DecCoin(t)), +// mtypes.NewEventLeaseClosed(testutil.LeaseID(t), testutil.DecCoin(t)), +// +// // x/provider events +// ptypes.NewEventProviderCreated(testutil.AccAddress(t)), +// ptypes.NewEventProviderUpdated(testutil.AccAddress(t)), +// ptypes.NewEventProviderDeleted(testutil.AccAddress(t)), +// } +// +// for _, test := range tests { +// sdkevs := sdk.Events{ +// test.ToSDKEvent(), +// }.ToABCIEvents() +// +// sdkev := sdkevs[0] +// +// ev, ok := processEvent(sdkev) +// assert.True(t, ok, test) +// assert.Equal(t, test, ev, test) +// } +// } diff --git a/events/query.go b/events/query.go index 249b842eaa..b36765b73a 100644 --- a/events/query.go +++ b/events/query.go @@ -3,9 +3,9 @@ package events import ( "fmt" - "github.com/tendermint/tendermint/libs/pubsub" - tmquery "github.com/tendermint/tendermint/libs/pubsub/query" - tmtypes "github.com/tendermint/tendermint/types" + "github.com/cometbft/cometbft/libs/pubsub" + tmquery "github.com/cometbft/cometbft/libs/pubsub/query" + tmtypes "github.com/cometbft/cometbft/types" ) func txQuery() pubsub.Query { diff --git a/go.mod b/go.mod index 3df9d1f160..ce0cb48f01 100644 --- a/go.mod +++ b/go.mod @@ -1,50 +1,50 @@ -module github.com/akash-network/node +module pkg.akt.dev/akashd -go 1.21 +go 1.22 require ( github.com/akash-network/akash-api v0.0.67 - github.com/blang/semver/v4 v4.0.0 github.com/boz/go-lifecycle v0.1.1 - github.com/cosmos/cosmos-sdk v0.45.16 + github.com/cometbft/cometbft v0.37.5 + github.com/cometbft/cometbft-db v0.11.0 + github.com/cosmos/cosmos-sdk v0.47.12 github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/ibc-go/v4 v4.6.0 - github.com/gogo/protobuf v1.3.3 - github.com/google/go-github/v56 v56.0.0 + github.com/cosmos/gogoproto v1.4.12 + github.com/cosmos/ibc-go/v7 v7.4.0 + github.com/google/go-github/v62 v62.0.0 github.com/gorilla/mux v1.8.1 github.com/gorilla/websocket v1.5.1 github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240326020559-581a3f7c677f - github.com/pkg/errors v0.9.1 // don't upgrade it as current cosmos-sdk version uses some functions which were removed after v1.16.0 github.com/prometheus/client_golang v1.16.0 github.com/rakyll/statik v0.1.7 github.com/regen-network/cosmos-proto v0.3.1 github.com/rs/zerolog v1.32.0 + github.com/skip-mev/block-sdk v1.4.2 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 - github.com/tendermint/tendermint v0.34.27 - github.com/tendermint/tm-db v0.6.7 github.com/theckman/yacspin v0.13.12 - go.step.sm/crypto v0.44.6 + go.step.sm/crypto v0.44.8 golang.org/x/mod v0.17.0 golang.org/x/oauth2 v0.19.0 golang.org/x/sync v0.7.0 google.golang.org/grpc v1.63.2 gopkg.in/yaml.v3 v3.0.1 + pkg.akt.dev/go v0.0.1-rc2 ) -retract ( - v0.34.0 - v0.28.1 - v0.28.0 - v0.26.0 - v0.22.1 -) +//retract ( +// v0.34.0 +// v0.28.1 +// v0.28.0 +// v0.26.0 +// v0.22.1 +//) replace ( // use cosmos fork of keyring @@ -52,13 +52,12 @@ replace ( // use akash version of cosmos ledger api github.com/cosmos/ledger-cosmos-go => github.com/akash-network/ledger-go/cosmos v0.14.4 - // dgrijalva/jwt-go is deprecated and doesn't receive security updates. - // TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134 - github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 - // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1 + // latest grpc doesn't work with with cosmos-sdk modified proto compiler, so we need to enforce + // the following version across all dependencies. + //google.golang.org/grpc => google.golang.org/grpc v1.33.2 // Use regen gogoproto fork // To be replaced by cosmos/gogoproto in future versions github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 @@ -66,109 +65,144 @@ replace ( github.com/tendermint/tendermint => github.com/akash-network/cometbft v0.34.27-akash github.com/zondax/hid => github.com/troian/hid v0.13.2 github.com/zondax/ledger-go => github.com/akash-network/ledger-go v0.14.3 - // latest grpc doesn't work with with cosmos-sdk modified proto compiler, so we need to enforce - // the following version across all dependencies. - google.golang.org/grpc => google.golang.org/grpc v1.33.2 ) require ( - cosmossdk.io/api v0.2.6 // indirect + cosmossdk.io/api v0.3.1 + cosmossdk.io/math v1.3.0 + github.com/tendermint/tendermint v0.34.27 +) + +require ( + cloud.google.com/go v0.112.0 // indirect + cloud.google.com/go/auth v0.2.2 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.1 // indirect + cloud.google.com/go/compute/metadata v0.3.0 // indirect + cloud.google.com/go/iam v1.1.6 // indirect + cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.3 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/errors v1.0.1 // indirect + cosmossdk.io/log v1.3.1 // indirect + cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect + github.com/99designs/keyring v1.2.2 // indirect + github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect github.com/DataDog/zstd v1.5.0 // indirect - github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect - github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/armon/go-metrics v0.4.1 // indirect + github.com/aws/aws-sdk-go v1.44.224 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cockroachdb/errors v1.9.1 // indirect + github.com/chzyer/readline v1.5.1 // indirect + github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677 // indirect - github.com/cockroachdb/redact v1.1.3 // indirect + github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/cometbft/cometbft-db v0.7.0 // indirect github.com/confio/ics23/go v0.9.1 // indirect - github.com/cosmos/btcutil v1.0.4 // indirect - github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.1 // indirect - github.com/cosmos/gorocksdb v1.2.0 // indirect - github.com/cosmos/iavl v0.19.5 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect + github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect + github.com/cosmos/gogogateway v1.2.0 // indirect + github.com/cosmos/iavl v0.20.1 // indirect + github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect + github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect - github.com/creachadair/taskgroup v0.3.2 // indirect + github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.0.3 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect - github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/edwingeng/deque/v2 v2.1.1 // indirect - github.com/fatih/color v1.14.1 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getsentry/sentry-go v0.17.0 // indirect + github.com/getsentry/sentry-go v0.23.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect - github.com/gogo/gateway v1.1.0 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.3 // indirect + github.com/golang/glog v1.2.0 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/orderedcode v0.0.1 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.3 // indirect github.com/gorilla/handlers v1.5.1 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-getter v1.7.1 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.1-0.20191016231534-914dc3f8dd7c // indirect - github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect - github.com/improbable-eng/grpc-web v0.14.1 // indirect + github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/huandu/skiplist v1.2.0 // indirect + github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.1-0.20191019112844-b572e7f4cdac // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.0 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.6 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.7.10 // indirect + github.com/linxGnu/grocksdb v1.8.12 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect + github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // 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.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect + github.com/prometheus/client_model v0.4.0 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.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.10.0 // indirect - github.com/rs/cors v1.8.2 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/rs/cors v1.8.3 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -177,33 +211,42 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tidwall/btree v1.5.0 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect - go.etcd.io/bbolt v1.3.6 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect + github.com/tidwall/btree v1.6.0 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect + go.etcd.io/bbolt v1.3.8 // indirect + go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.uber.org/multierr v1.10.0 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect golang.org/x/net v0.24.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect + google.golang.org/api v0.176.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect + google.golang.org/protobuf v1.34.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/api v0.26.1 // indirect - k8s.io/apimachinery v0.26.1 // indirect - k8s.io/klog/v2 v2.80.1 // indirect - k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect + k8s.io/api v0.30.0 // indirect + k8s.io/apimachinery v0.30.0 // indirect + k8s.io/klog/v2 v2.120.1 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect nhooyr.io/websocket v1.8.6 // indirect - sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect + pgregory.net/rapid v1.1.0 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index bcef38da5f..95295f88d6 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= @@ -7,21 +8,202 @@ cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTj cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= +cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= +cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= +cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= +cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= +cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= +cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= +cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= +cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= +cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= +cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= +cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= +cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= +cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= +cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= +cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= +cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= +cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= +cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= +cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= +cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= +cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= +cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/auth v0.2.2 h1:gmxNJs4YZYcw6YvKRtVBaF2fyUE6UrWPyzU8jHvYfmI= +cloud.google.com/go/auth v0.2.2/go.mod h1:2bDNJWtWziDT3Pu1URxHHbkHE/BbOCuyUiKIGcNvafo= +cloud.google.com/go/auth/oauth2adapt v0.2.1 h1:VSPmMmUlT8CkIZ2PzD9AlLN+R3+D1clXMWHHa6vG/Ag= +cloud.google.com/go/auth/oauth2adapt v0.2.1/go.mod h1:tOdK/k+D2e4GEwfBRA48dKNQiDsqIXxLh7VU319eV0g= +cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= +cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= +cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= +cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= +cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= +cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= +cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= +cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= +cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= +cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= +cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= +cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= +cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= +cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= +cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= +cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= +cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= +cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= +cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= +cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= +cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= +cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= +cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= +cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= +cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= +cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= +cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= +cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= +cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= +cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= +cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= +cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= +cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= +cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= +cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= +cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= +cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= +cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= +cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= +cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= +cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= +cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= +cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= +cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= +cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= +cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= +cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= +cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= +cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= +cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= +cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= +cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= +cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= +cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= +cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= +cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= +cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= +cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= +cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= +cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= +cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= +cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= +cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= +cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= +cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= +cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= +cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= +cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= +cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= +cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= +cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= +cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= +cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= +cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= +cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= +cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= +cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= +cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= +cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= +cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= +cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= +cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= +cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= +cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= +cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= +cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= +cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= +cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= +cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= +cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= +cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= +cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= +cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= +cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= +cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= +cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= +cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= +cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= +cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= +cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= +cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= +cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= +cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= +cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= +cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= +cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= +cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -cosmossdk.io/api v0.2.6 h1:AoNwaLLapcLsphhMK6+o0kZl+D6MMUaHVqSdwinASGU= -cosmossdk.io/api v0.2.6/go.mod h1:u/d+GAxil0nWpl1XnQL8nkziQDIWuBDhv8VnDm/s6dI= +cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= +cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= -cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= -cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= +cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= +cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= +cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= @@ -30,7 +212,6 @@ git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFN git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= @@ -38,43 +219,30 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOEl github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw= -github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= -github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= -github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= +github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= +github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.5.0 h1:+K/VEwIAaPcHiMtQvpLD4lqW7f0Gk3xdYZmI1hD+CXo= github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= -github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= -github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM= 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/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= -github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/akash-network/akash-api v0.0.67 h1:lwtSvYoxXe/XJKB0UabA2np3l0ujLMsKxmA4e6IWzsM= github.com/akash-network/akash-api v0.0.67/go.mod h1:PdOQGTCX3kLBoKHdbPF9pe5+vSLANaMJbgA04UE+OqY= @@ -84,8 +252,6 @@ github.com/akash-network/ledger-go v0.14.3 h1:LCEFkTfgGA2xFMN2CtiKvXKE7dh0QSM77P github.com/akash-network/ledger-go v0.14.3/go.mod h1:NfsjfFvno9Kaq6mfpsKz4sqjnAVVEsVsnBJfKB4ueAs= github.com/akash-network/ledger-go/cosmos v0.14.4 h1:h3WiXmoKKs9wkj1LHcJ12cLjXXg6nG1fp+UQ5+wu/+o= github.com/akash-network/ledger-go/cosmos v0.14.4/go.mod h1:SjAfheQTE4rWk0ir+wjbOWxwj8nc8E4AZ08NdsvYG24= -github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7/go.mod h1:NumScqsC42o9x+dGj8/YqsIfhrIQjFEOFovxotbBirA= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -106,6 +272,9 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ= +github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= @@ -116,11 +285,13 @@ github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7 github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= -github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -155,11 +326,16 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= @@ -167,40 +343,53 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= -github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= +github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4= -github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= -github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= -github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= -github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677 h1:qbb/AE938DFhOajUYh9+OXELpSF9KZw2ZivtmW6eX1Q= -github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677/go.mod h1:890yq1fUb9b6dGNwssgeUO5vQV9qfXnCPxAJhBQfXw0= -github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= -github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= -github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= +github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0= +github.com/cometbft/cometbft v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY= +github.com/cometbft/cometbft-db v0.11.0 h1:M3Lscmpogx5NTbb1EGyGDaFRdsoLWrUWimFEyf7jej8= +github.com/cometbft/cometbft-db v0.11.0/go.mod h1:GDPJAC/iFHNjmZZPN8V8C1yr/eyityhi2W1hz2MGKSc= github.com/confio/ics23/go v0.9.1 h1:3MV46eeWwO3xCauKyAtuAdJYMyPnnchW4iLr2bTw6/U= github.com/confio/ics23/go v0.9.1/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= @@ -215,37 +404,38 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= -github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= -github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 h1:zlCp9n3uwQieELltZWHRmwPmPaZ8+XoL2Sj+A2YJlr8= -github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32/go.mod h1:kwMlEC4wWvB48zAShGKVqboJL6w4zCLesaNQ3YLU2BQ= -github.com/cosmos/cosmos-proto v1.0.0-beta.1 h1:iDL5qh++NoXxG8hSy93FdYJut4XfgbShIocllGaXx/0= -github.com/cosmos/cosmos-proto v1.0.0-beta.1/go.mod h1:8k2GNZghi5sDRFw/scPL8gMSowT1vDA+5ouxL8GjaUE= -github.com/cosmos/cosmos-sdk v0.45.16 h1:5ba/Bh5/LE55IwHQuCU4fiG4eXeDKtSWzehXRpaKDcw= -github.com/cosmos/cosmos-sdk v0.45.16/go.mod h1:bScuNwWAP0TZJpUf+SHXRU3xGoUPp+X9nAzfeIXts40= +github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= +github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= +github.com/cosmos/cosmos-sdk v0.47.11 h1:0Qx7eORw0RJqPv+mvDuU8NQ1LV3nJJKJnPoYblWHolc= +github.com/cosmos/cosmos-sdk v0.47.11/go.mod h1:ADjORYzUQqQv/FxDi0H0K5gW/rAk1CiDR3ZKsExfJV0= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= -github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= -github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v4 v4.6.0 h1:G7kiD4Zf8Wrxc8BXWIKuFnzI0W4wpvRPrl5HwdfTIsA= -github.com/cosmos/ibc-go/v4 v4.6.0/go.mod h1:ksiZHUypws0NVP50E3ea0ivVFO/bfS8q8yLg8yZ2ATQ= +github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= +github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= +github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= +github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= +github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= +github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= +github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M= +github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= +github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= +github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= +github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= +github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= -github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= +github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= +github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= -github.com/cucumber/common/gherkin/go/v22 v22.0.0/go.mod h1:3mJT10B2GGn3MvVPd3FwR7m2u4tLhSRhWUqJU4KN4Fg= -github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= -github.com/cucumber/common/messages/go/v17 v17.1.1/go.mod h1:bpGxb57tDE385Rb2EohgUadLkAbhoC4IyCFi89u/JQI= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= @@ -256,21 +446,24 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= -github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= @@ -287,10 +480,11 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= -github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= +github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= @@ -298,28 +492,26 @@ github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7j github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edwingeng/deque/v2 v2.1.1 h1:+xjC3TnaeMPLZMi7QQf9jN2K00MZmTwruApqplbL9IY= github.com/edwingeng/deque/v2 v2.1.1/go.mod h1:HukI8CQe9KDmZCcURPZRYVYjH79Zy2tIjTF9sN3Bgb0= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= -github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= @@ -329,16 +521,14 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= -github.com/getsentry/sentry-go v0.17.0 h1:UustVWnOoDFHBS7IJUB2QK/nB5pap748ZEp0swnQJak= -github.com/getsentry/sentry-go v0.17.0/go.mod h1:B82dxtBvxG0KaPD8/hfSV+VcHD+Lg/xUS4JuQn1P4cM= -github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= +github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= +github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= @@ -346,9 +536,7 @@ github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -359,17 +547,19 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -385,6 +575,7 @@ github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5Nq github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -398,24 +589,30 @@ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= -github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= -github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= -github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= +github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -423,6 +620,7 @@ github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -433,6 +631,7 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= @@ -441,7 +640,6 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= -github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= @@ -453,14 +651,19 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4= github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= @@ -468,19 +671,57 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= +github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= +github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= +github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= +github.com/googleapis/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= +github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= +github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= @@ -491,7 +732,6 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= @@ -501,10 +741,9 @@ github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJr github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -521,6 +760,10 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= +github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -528,12 +771,15 @@ github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iP github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -547,22 +793,24 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= -github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= +github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= +github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= +github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= +github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= -github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240326020559-581a3f7c677f h1:+GVBxNU56C6bwGEUsy2yJdXo7MwJWFAr7rhELFSNaig= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240326020559-581a3f7c677f/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw= -github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= +github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -578,20 +826,16 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= -github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= -github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= -github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= -github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= -github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.13.1-0.20220928232736-101791cb1b4c h1:XImQJfpJLmGEEd8ll5yPVyL/aEvmgGHW4WYTyNseLOM= -github.com/jhump/protoreflect v1.13.1-0.20220928232736-101791cb1b4c/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= +github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/levigo v1.0.1-0.20191019112844-b572e7f4cdac h1:GcJkaxD5Wy/Ucn+L0USlpbGJy9O6+7r0nBI7ftJ7Uu0= github.com/jmhodges/levigo v1.0.1-0.20191019112844-b572e7f4cdac/go.mod h1:dM7ihgFM8Do6WGIfOXWPgpJ+4bKGR/4ZkYh8HKDdFy4= @@ -609,38 +853,22 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= -github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= -github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk= -github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= -github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U= -github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= -github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw= -github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= -github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0= -github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= -github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -656,35 +884,35 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs= -github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.7.10 h1:dz7RY7GnFUA+GJO6jodyxgkUeGMEkPp3ikt9hAcNGEw= -github.com/linxGnu/grocksdb v1.7.10/go.mod h1:0hTf+iA+GOr0jDX4CgIYyJZxqOH9XlBh6KVj8+zmF34= +github.com/linxGnu/grocksdb v1.8.12 h1:1/pCztQUOa3BX/1gR3jSZDoaKFpeHFvQ1XrqZpSvZVo= +github.com/linxGnu/grocksdb v1.8.12/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= +github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -694,23 +922,20 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= -github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= -github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= -github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= @@ -719,8 +944,11 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -738,7 +966,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= @@ -751,16 +978,15 @@ github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -768,24 +994,27 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= -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.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys= -github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= +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.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= +github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= -github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= -github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= +github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -797,8 +1026,6 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= -github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ= -github.com/otiai10/copy v1.6.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -812,10 +1039,10 @@ github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdU github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= +github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= -github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= @@ -845,8 +1072,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -855,16 +1082,16 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/prometheus/procfs v0.11.0 h1:5EAgkfkMl659uZPbe9AS2N68a7Cc1TJbPEuGzFuRbyk= +github.com/prometheus/procfs v0.11.0/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= @@ -873,8 +1100,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= -github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= -github.com/regen-network/gocuke v0.6.2/go.mod h1:zYaqIHZobHyd0xOrHGPQjbhGJsuZ1oElx150u2o1xuk= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= @@ -886,13 +1111,12 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= -github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= +github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= @@ -901,7 +1125,6 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -909,22 +1132,21 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= -github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/skip-mev/block-sdk v1.4.2 h1:oNXPnNjeSEthCcdMd7L0aB+6/v4W4ydfpIm2miekJ/U= +github.com/skip-mev/block-sdk v1.4.2/go.mod h1:rVPgr1X5tMyOwcPxNalJEDErgC4ynVbVQdmI89Txhv4= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 h1:unQFBIznI+VYD1/1fApl1A+9VcBk+9dcqGfnePY87LY= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262/go.mod h1:MyOHs9Po2fbM1LHej6sBUT8ozbxmMOFG+E+rx/GSGuc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -972,97 +1194,109 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/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/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= -github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= github.com/theckman/yacspin v0.13.12 h1:CdZ57+n0U6JMuh2xqjnjRq5Haj6v1ner2djtLQRzJr4= github.com/theckman/yacspin v0.13.12/go.mod h1:Rd2+oG2LmQi5f3zC3yeZAOl245z8QOvrH4OPOJNZxLg= -github.com/tidwall/btree v1.5.0 h1:iV0yVY/frd7r6qGBXfEYs7DH0gTDgrKTrDjS7xt/IyQ= -github.com/tidwall/btree v1.5.0/go.mod h1:LGm8L/DZjPLmeWGjv5kFrY8dL4uVhMmzmmLYmsObdKE= +github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= +github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= -github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/troian/hid v0.13.2 h1:O7PWZQm5YGyg0nVvknFVLVrNTPillz4ZXvxJOtoyteE= github.com/troian/hid v0.13.2/go.mod h1:n6adloQ1876oEXZr6fFsthy4FDHxwJhh7QYQspm30Ds= -github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= -github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= -github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.step.sm/crypto v0.44.6 h1:vQg8ujce7fNXDO8EWdriSz+ZSJpYnNh22QrFtRjdyoY= -go.step.sm/crypto v0.44.6/go.mod h1:oKRO4jaf2MaCohJDN+/8ShImkvIgUKfJxxy87gqsnXs= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.step.sm/crypto v0.44.8 h1:jDSHL6FdB1UTA0d56ECNx9XtLVkewzeg38Vy3HWB3N8= +go.step.sm/crypto v0.44.8/go.mod h1:QEmu4T9YewrDuaJnrV1I0zWZ15aJ/mqRUfL5w3R2WgU= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1075,7 +1309,6 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1097,13 +1330,16 @@ golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm0 golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= +golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -1111,6 +1347,9 @@ golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -1120,11 +1359,15 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1134,34 +1377,59 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1169,6 +1437,26 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg= golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1177,12 +1465,18 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1214,47 +1508,89 @@ golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -1263,6 +1599,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1271,15 +1608,17 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1292,33 +1631,63 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/gonum v0.8.2 h1:CCXrcPKiGGotvnN6jfUsKk4rRqm7q09/YbKb5xCEvtM= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= @@ -1330,12 +1699,57 @@ google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEn google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= +google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= +google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= +google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= +google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= +google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= +google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= +google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= +google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= +google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= +google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= +google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= +google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= +google.golang.org/api v0.176.0 h1:dHj1/yv5Dm/eQTXiP9hNCRT3xzJHWXeNdRq29XbMxoE= +google.golang.org/api v0.176.0/go.mod h1:Rra+ltKu14pps/4xTycZfobMgLpbosoaaL7c+SEMrO8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1352,20 +1766,149 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= +google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= +google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= +google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= +google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 h1:rIo7ocm2roD9DcFIX67Ym8icoGCKSARAiPljFhh5suQ= google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1378,27 +1921,27 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -1416,41 +1959,47 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= -gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -k8s.io/api v0.26.1 h1:f+SWYiPd/GsiWwVRz+NbFyCgvv75Pk9NK6dlkZgpCRQ= -k8s.io/api v0.26.1/go.mod h1:xd/GBNgR0f707+ATNyPmQ1oyKSgndzXij81FzWGsejg= -k8s.io/apimachinery v0.26.1 h1:8EZ/eGJL+hY/MYCNwhmDzVqq2lPl3N3Bo8rvweJwXUQ= -k8s.io/apimachinery v0.26.1/go.mod h1:tnPmbONNJ7ByJNz9+n9kMjNP8ON+1qoAIIC70lztu74= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/utils v0.0.0-20221107191617-1a15be271d1d h1:0Smp/HP1OH4Rvhe+4B8nWGERtlqAGSftbSbbmm45oFs= -k8s.io/utils v0.0.0-20221107191617-1a15be271d1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/api v0.30.0 h1:siWhRq7cNjy2iHssOB9SCGNCl2spiF1dO3dABqZ8niA= +k8s.io/api v0.30.0/go.mod h1:OPlaYhoHs8EQ1ql0R/TsUgaRPhpKNxIMrKQfWUp8QSE= +k8s.io/apimachinery v0.30.0 h1:qxVPsyDM5XS96NIh9Oj6LavoVFYff/Pon9cZeDIkHHA= +k8s.io/apimachinery v0.30.0/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.5.3 h1:163N50IHFqr1phZens4FQOdPgfJscR7a562mjQqeo4M= -pgregory.net/rapid v0.5.3/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +pkg.akt.dev/go v0.0.1-rc2 h1:xNxv5HcocHILAKZdzWsm7eLfmDAIO8CxFkL1EoDUT+g= +pkg.akt.dev/go v0.0.1-rc2/go.mod h1:0xdDZR1wcP4RCLFRN2HPKPTMQEDa3ycLNxcWDWg/SQc= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= -sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= -sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/pubsub/bus_test.go b/pubsub/bus_test.go index 4af2730383..593c8aa603 100644 --- a/pubsub/bus_test.go +++ b/pubsub/bus_test.go @@ -3,10 +3,10 @@ package pubsub_test import ( "testing" - "github.com/akash-network/node/pubsub" + "github.com/cometbft/cometbft/crypto/ed25519" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/ed25519" + "pkg.akt.dev/akashd/pubsub" ) func TestBus(t *testing.T) { diff --git a/script/tools.sh b/script/tools.sh index e5f929669c..768751c0fa 100755 --- a/script/tools.sh +++ b/script/tools.sh @@ -38,8 +38,85 @@ function get_gotoolchain() { echo -n "$gotoolchain" } +replace_paths() { + local file="${1}" + local cimport="${2}" + local nimport="${3}" + local sedcmd=sed + + if [[ "$OSTYPE" == "darwin"* ]]; then + sedcmd=gsed + fi + + $sedcmd -ri "s~$cimport~$nimport~" "${file}" +} + +function replace_import_path() { + local next_major_version=$1 + local curr_module_name + local curr_version + local new_module_name + + curr_module_name=$(cd go; go list -m) + curr_version=$(echo "$curr_module_name" | sed -n 's/.*v\([0-9]*\).*/\1/p') + new_module_name=${curr_module_name%/"v$curr_version"}/$next_major_version + + echo "current import paths are $curr_module_name, replacing with $new_module_name" + + declare -a modules_to_upgrade_manually + + modules_to_upgrade_manually+=("./go/go.mod") + + echo "preparing files to replace" + + declare -a files + + while IFS= read -r line; do + files+=("$line") + done < <(find . -type f -not \( \ + -path "./install.sh" \ + -or -path "./upgrades/*" \ + -or -path "./.cache/*" \ + -or -path "./dist/*" \ + -or -path "./.git*" \ + -or -name "*.md" \ + -or -path "./.idea/*" \)) + + echo "updating all files" + + for file in "${files[@]}"; do + if test -f "$file"; then + # skip files that need manual upgrading + for excluded_file in "${modules_to_upgrade_manually[@]}"; do + if [[ "$file" == *"$excluded_file"* ]]; then + continue 2 + fi + done + + replace_paths "$file" "\"$curr_module_name" "\"$new_module_name" + fi + done + + echo "updating go.mod" + for retract in $(cd go; go mod edit --json | jq -cr '.Retract | if . != null then .[] else empty end'); do + local low + local high + + low=$(jq -r '.Low' <<<"$retract") + high=$(jq -r '.High' <<<"$retract") + echo " dropping retract: [$low, $high]" + go mod edit -dropretract=["$low","$high"] + done + + replace_paths "./go/go.mod" "$curr_module_name" "$new_module_name" +} + case "$1" in gotoolchain) get_gotoolchain ;; +replace-import-path) + shift + replace_import_path "$@" + ;; esac diff --git a/sdl/_testdata/deployment-svc-mismatch.yaml b/sdl/_testdata/deployment-svc-mismatch.yaml deleted file mode 100644 index 6bb33b41c6..0000000000 --- a/sdl/_testdata/deployment-svc-mismatch.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - webapp: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/private_service.yaml b/sdl/_testdata/private_service.yaml deleted file mode 100644 index 73db7d9606..0000000000 --- a/sdl/_testdata/private_service.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -version: "2.0" -services: - bind: - image: bind9 - expose: - - port: 53 - proto: udp - to: - - global: true - - pg: - image: postgresql - expose: - - port: 5463 - to: - - service: bind - -profiles: - compute: - bind: - resources: - cpu: - units: "50m" - memory: - size: "64Mi" - storage: - size: "16Mi" - pg: - resources: - cpu: - units: "500m" - memory: - size: "512Mi" - storage: - size: "1000Mi" - - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - pg: - denom: uakt - amount: 1000 - bind: - denom: uakt - amount: 333 -deployment: - pg: - westcoast: - profile: pg - count: 1 - bind: - westcoast: - profile: bind - count: 8 diff --git a/sdl/_testdata/profile-svc-name-mismatch.yaml b/sdl/_testdata/profile-svc-name-mismatch.yaml deleted file mode 100644 index ea88ff49ce..0000000000 --- a/sdl/_testdata/profile-svc-name-mismatch.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -version: "2.0" - -services: - webapp: - image: ghcr.io/akash-network/demo-app - expose: - - port: 80 - as: 80 - accept: - - thehostname.com - to: - - global: true - -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "512Mi" - storage: - size: "512Mi" - placement: - san-jose: - attributes: - region: sjc - pricing: - web: - denom: uakt - amount: 25 - -deployment: - webapp: - san-jose: - profile: web - count: 1 diff --git a/sdl/_testdata/service-mix.yaml b/sdl/_testdata/service-mix.yaml deleted file mode 100644 index 51a21a01ed..0000000000 --- a/sdl/_testdata/service-mix.yaml +++ /dev/null @@ -1,80 +0,0 @@ ---- -version: "2.0" -services: - svca: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - svcb: - image: nginx - expose: - - port: 80 - accept: - - bhostname.com - to: - - global: true - - port: 12346 - to: - - global: true - proto: udp - -profiles: - compute: - profilea: - resources: - cpu: - units: "100m" - gpu: - units: "1" - attributes: - vendor: - nvidia: - memory: - size: "128Mi" - storage: - - size: "1Gi" - profileb: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - blalbla: foo - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - profilea: - denom: uakt - amount: 50 - profileb: - denom: uakt - amount: 50 - -deployment: - svca: - westcoast: - profile: profilea - count: 1 - svcb: - westcoast: - profile: profileb - count: 1 diff --git a/sdl/_testdata/service-mix2.yaml b/sdl/_testdata/service-mix2.yaml deleted file mode 100644 index 3eb556d980..0000000000 --- a/sdl/_testdata/service-mix2.yaml +++ /dev/null @@ -1,69 +0,0 @@ ---- -version: "2.0" -services: - svca: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - svcb: - image: nginx - expose: - - port: 80 - accept: - - bhostname.com - to: - - global: true - - port: 12346 - to: - - global: true - proto: udp - -profiles: - compute: - profilea: - resources: - cpu: - units: "100m" - gpu: - units: "1" - attributes: - vendor: - nvidia: - memory: - size: "128Mi" - storage: - - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - blalbla: foo - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - profilea: - denom: uakt - amount: 50 - -deployment: - svca: - westcoast: - profile: profilea - count: 1 - svcb: - westcoast: - profile: profilea - count: 1 diff --git a/sdl/_testdata/simple-double-ram.yaml b/sdl/_testdata/simple-double-ram.yaml deleted file mode 100644 index 6e1bdb5cb6..0000000000 --- a/sdl/_testdata/simple-double-ram.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "256Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/simple-gpu.yaml b/sdl/_testdata/simple-gpu.yaml deleted file mode 100644 index 84048e6f0b..0000000000 --- a/sdl/_testdata/simple-gpu.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - gpu: - units: 1 - attributes: - vendor: - nvidia: - - model: a100 - memory: - size: "128Mi" - storage: - - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - blalbla: foo - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/simple-with-ip.yaml b/sdl/_testdata/simple-with-ip.yaml deleted file mode 100644 index 4308f095ee..0000000000 --- a/sdl/_testdata/simple-with-ip.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - ip: "meow" - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 - -endpoints: - meow: - kind: "ip" diff --git a/sdl/_testdata/simple.yaml b/sdl/_testdata/simple.yaml deleted file mode 100644 index d164e60e9d..0000000000 --- a/sdl/_testdata/simple.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/simple2.yaml b/sdl/_testdata/simple2.yaml deleted file mode 100644 index 08dfa81c86..0000000000 --- a/sdl/_testdata/simple2.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - bew: - image: nginx - expose: - - port: 8080 - accept: - - bhostname.com - to: - - global: true - - port: 12346 - to: - - global: true - proto: udp - - port: 12347 - to: - - global: true - proto: udp -profiles: - compute: - bew: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 - bew: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: bew - count: 2 diff --git a/sdl/_testdata/simple3.yaml b/sdl/_testdata/simple3.yaml deleted file mode 100644 index 9e01620896..0000000000 --- a/sdl/_testdata/simple3.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: "2.0" - -services: - app: - image: ubuntu:22.04 - command: - - "sh" - - "-c" - args: - - 'sleep infinity' - expose: - - port: 80 - as: 80 - to: - - global: true - - port: 22 - as: 22 - to: - - global: true - -profiles: - compute: - app: - resources: - cpu: - units: 1 - memory: - size: 2Gi - storage: - size: 10Gi - placement: - akash: - attributes: - host: akash - pricing: - app: - denom: uakt - amount: 1000000 - -deployment: - app: - akash: - profile: app - count: 1 diff --git a/sdl/_testdata/simple4.yaml b/sdl/_testdata/simple4.yaml deleted file mode 100644 index 1f55548556..0000000000 --- a/sdl/_testdata/simple4.yaml +++ /dev/null @@ -1,90 +0,0 @@ ---- -version: '2.0' -services: - wordpress: - image: wordpress - depends_on: - - db - expose: - - port: 80 - http_options: - max_body_size: 104857600 - # accept: - # - "example.com" - to: - - global: true - env: - - WORDPRESS_DB_HOST=db - - WORDPRESS_DB_USER=wordpress - - WORDPRESS_DB_PASSWORD=testpass4you - - WORDPRESS_DB_NAME=wordpress - params: - storage: - wordpress-data: - mount: /var/www/html - readOnly: false - db: - # We use a mariadb image which supports both amd64 & arm64 architecture - image: mariadb:10.6.4 - # If you really want to use MySQL, uncomment the following line - #image: mysql:8.0.27 - expose: - - port: 3306 - to: - - service: wordpress - env: - - MYSQL_RANDOM_ROOT_PASSWORD=1 - - MYSQL_DATABASE=wordpress - - MYSQL_USER=wordpress - - MYSQL_PASSWORD=testpass4you - params: - storage: - wordpress-db: - mount: /var/lib/mysql - readOnly: false -profiles: - compute: - wordpress: - resources: - cpu: - units: 1 - memory: - size: 1Gi - storage: - - size: 1Gi - - name: wordpress-data - size: 1Gi - attributes: - persistent: true - class: beta3 - db: - resources: - cpu: - units: 1 - memory: - size: 1Gi - storage: - - size: 1Gi - - name: wordpress-db - size: 1Gi - attributes: - persistent: true - class: beta3 - placement: - akash: - pricing: - wordpress: - denom: uakt - amount: 10000 - db: - denom: uakt - amount: 10000 -deployment: - wordpress: - akash: - profile: wordpress - count: 1 - db: - akash: - profile: db - count: 1 diff --git a/sdl/_testdata/storageClass1.yaml b/sdl/_testdata/storageClass1.yaml deleted file mode 100644 index 695e0b647b..0000000000 --- a/sdl/_testdata/storageClass1.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - params: - storage: - configs: -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: "1Gi" - - size: 1Gi - name: configs - attributes: - persistent: true - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 1 diff --git a/sdl/_testdata/storageClass2.yaml b/sdl/_testdata/storageClass2.yaml deleted file mode 100644 index 5f907cf07f..0000000000 --- a/sdl/_testdata/storageClass2.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - params: - storage: - configs: - mount: etc/nginx -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: 1Gi - - size: 1Gi - name: configs - attributes: - persistent: true - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 1 diff --git a/sdl/_testdata/storageClass3.yaml b/sdl/_testdata/storageClass3.yaml deleted file mode 100644 index 1e0bae8e61..0000000000 --- a/sdl/_testdata/storageClass3.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - params: - storage: - data: -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: 1Gi - - size: 1Gi - name: configs - attributes: - persistent: true - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 1 diff --git a/sdl/_testdata/storageClass4.yaml b/sdl/_testdata/storageClass4.yaml deleted file mode 100644 index 5ca8af53f9..0000000000 --- a/sdl/_testdata/storageClass4.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - params: - storage: - config: - mount: /etc/nginx - data: - mount: /etc/nginx -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: 1Gi - - size: 1Gi - name: config - attributes: - persistent: true - - size: 1Gi - name: data - attributes: - persistent: true - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 1 diff --git a/sdl/_testdata/storageClass5.yaml b/sdl/_testdata/storageClass5.yaml deleted file mode 100644 index 5c280bb1d2..0000000000 --- a/sdl/_testdata/storageClass5.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - params: - storage: -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: "1Gi" - - size: 1Gi - name: configs - attributes: - persistent: true - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 1 diff --git a/sdl/_testdata/storageClass6.yaml b/sdl/_testdata/storageClass6.yaml deleted file mode 100644 index fccfb944c9..0000000000 --- a/sdl/_testdata/storageClass6.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - params: - storage: - configs: - mount: /test -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: "1Gi" - - size: 1Gi - name: configs - attributes: - persistent: true - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 1 diff --git a/sdl/_testdata/v2.1-credentials-error.yaml b/sdl/_testdata/v2.1-credentials-error.yaml deleted file mode 100644 index 83e3fc24df..0000000000 --- a/sdl/_testdata/v2.1-credentials-error.yaml +++ /dev/null @@ -1,48 +0,0 @@ ---- -version: "2.1" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - credentials: - username: "foo" - password: "foo" -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/v2.1-credentials.yaml b/sdl/_testdata/v2.1-credentials.yaml deleted file mode 100644 index 63622b0a61..0000000000 --- a/sdl/_testdata/v2.1-credentials.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -version: "2.1" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - credentials: - host: "https://test.com/v1" - username: "foo" - password: "foo" -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/v2.1-deployment-svc-mismatch.yaml b/sdl/_testdata/v2.1-deployment-svc-mismatch.yaml deleted file mode 100644 index 59e98e0038..0000000000 --- a/sdl/_testdata/v2.1-deployment-svc-mismatch.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: "2.1" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - webapp: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/v2.1-private_service.yaml b/sdl/_testdata/v2.1-private_service.yaml deleted file mode 100644 index e4945869fc..0000000000 --- a/sdl/_testdata/v2.1-private_service.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -version: "2.1" -services: - bind: - image: bind9 - expose: - - port: 53 - proto: udp - to: - - global: true - - pg: - image: postgresql - expose: - - port: 5463 - to: - - service: bind - -profiles: - compute: - bind: - resources: - cpu: - units: "50m" - memory: - size: "64Mi" - storage: - size: "16Mi" - pg: - resources: - cpu: - units: "500m" - memory: - size: "512Mi" - storage: - size: "1000Mi" - - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - pg: - denom: uakt - amount: 1000 - bind: - denom: uakt - amount: 333 -deployment: - pg: - westcoast: - profile: pg - count: 1 - bind: - westcoast: - profile: bind - count: 8 diff --git a/sdl/_testdata/v2.1-profile-svc-name-mismatch.yaml b/sdl/_testdata/v2.1-profile-svc-name-mismatch.yaml deleted file mode 100644 index 3128102fab..0000000000 --- a/sdl/_testdata/v2.1-profile-svc-name-mismatch.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -version: "2.1" - -services: - webapp: - image: ghcr.io/akash-network/demo-app - expose: - - port: 80 - as: 80 - accept: - - thehostname.com - to: - - global: true - -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "512Mi" - storage: - size: "512Mi" - placement: - san-jose: - attributes: - region: sjc - pricing: - web: - denom: uakt - amount: 25 - -deployment: - webapp: - san-jose: - profile: web - count: 1 diff --git a/sdl/_testdata/v2.1-service-mix.yaml b/sdl/_testdata/v2.1-service-mix.yaml deleted file mode 100644 index 82991aff6f..0000000000 --- a/sdl/_testdata/v2.1-service-mix.yaml +++ /dev/null @@ -1,80 +0,0 @@ ---- -version: "2.1" -services: - svca: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - svcb: - image: nginx - expose: - - port: 80 - accept: - - bhostname.com - to: - - global: true - - port: 12346 - to: - - global: true - proto: udp - -profiles: - compute: - profilea: - resources: - cpu: - units: "100m" - gpu: - units: "1" - attributes: - vendor: - nvidia: - memory: - size: "128Mi" - storage: - - size: "1Gi" - profileb: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - blalbla: foo - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - profilea: - denom: uakt - amount: 50 - profileb: - denom: uakt - amount: 50 - -deployment: - svca: - westcoast: - profile: profilea - count: 1 - svcb: - westcoast: - profile: profileb - count: 1 diff --git a/sdl/_testdata/v2.1-service-mix2.yaml b/sdl/_testdata/v2.1-service-mix2.yaml deleted file mode 100644 index 7109fd466a..0000000000 --- a/sdl/_testdata/v2.1-service-mix2.yaml +++ /dev/null @@ -1,69 +0,0 @@ ---- -version: "2.1" -services: - svca: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - svcb: - image: nginx - expose: - - port: 80 - accept: - - bhostname.com - to: - - global: true - - port: 12346 - to: - - global: true - proto: udp - -profiles: - compute: - profilea: - resources: - cpu: - units: "100m" - gpu: - units: "1" - attributes: - vendor: - nvidia: - memory: - size: "128Mi" - storage: - - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - blalbla: foo - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - profilea: - denom: uakt - amount: 50 - -deployment: - svca: - westcoast: - profile: profilea - count: 1 - svcb: - westcoast: - profile: profilea - count: 1 diff --git a/sdl/_testdata/v2.1-simple-gpu.yaml b/sdl/_testdata/v2.1-simple-gpu.yaml deleted file mode 100644 index cc50fd82bf..0000000000 --- a/sdl/_testdata/v2.1-simple-gpu.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -version: "2.1" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - gpu: - units: 1 - attributes: - vendor: - nvidia: - - model: a100 - memory: - size: "128Mi" - storage: - - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - blalbla: foo - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/v2.1-simple-with-ip.yaml b/sdl/_testdata/v2.1-simple-with-ip.yaml deleted file mode 100644 index 4121c0e545..0000000000 --- a/sdl/_testdata/v2.1-simple-with-ip.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -version: "2.1" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - ip: "meow" - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 - -endpoints: - meow: - kind: "ip" diff --git a/sdl/_testdata/v2.1-simple.yaml b/sdl/_testdata/v2.1-simple.yaml deleted file mode 100644 index dc1ac31515..0000000000 --- a/sdl/_testdata/v2.1-simple.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: "2.1" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp -profiles: - compute: - web: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: web - count: 2 diff --git a/sdl/_testdata/v2.1-simple2.yaml b/sdl/_testdata/v2.1-simple2.yaml deleted file mode 100644 index 08dfa81c86..0000000000 --- a/sdl/_testdata/v2.1-simple2.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -version: "2.0" -services: - web: - image: nginx - expose: - - port: 80 - accept: - - ahostname.com - to: - - global: true - - port: 12345 - to: - - global: true - proto: udp - bew: - image: nginx - expose: - - port: 8080 - accept: - - bhostname.com - to: - - global: true - - port: 12346 - to: - - global: true - proto: udp - - port: 12347 - to: - - global: true - proto: udp -profiles: - compute: - bew: - resources: - cpu: - units: "100m" - memory: - size: "128Mi" - storage: - size: "1Gi" - placement: - westcoast: - attributes: - region: us-west - signedBy: - anyOf: - - 1 - - 2 - allOf: - - 3 - - 4 - pricing: - web: - denom: uakt - amount: 50 - bew: - denom: uakt - amount: 50 -deployment: - web: - westcoast: - profile: bew - count: 2 diff --git a/sdl/_testdata/v2.1-simple3.yaml b/sdl/_testdata/v2.1-simple3.yaml deleted file mode 100644 index b4d8713a02..0000000000 --- a/sdl/_testdata/v2.1-simple3.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -version: "2.1" - -services: - app: - image: ubuntu:22.04 - command: - - "sh" - - "-c" - args: - - 'sleep infinity' - expose: - - port: 80 - as: 80 - to: - - global: true - - port: 22 - as: 22 - to: - - global: true - -profiles: - compute: - app: - resources: - cpu: - units: 1 - memory: - size: 2Gi - storage: - size: 10Gi - placement: - akash: - attributes: - host: akash - pricing: - app: - denom: uakt - amount: 1000000 - -deployment: - app: - akash: - profile: app - count: 1 diff --git a/sdl/_testdata/v2.1-simple4.yaml b/sdl/_testdata/v2.1-simple4.yaml deleted file mode 100644 index 6a899a90c7..0000000000 --- a/sdl/_testdata/v2.1-simple4.yaml +++ /dev/null @@ -1,90 +0,0 @@ ---- -version: '2.1' -services: - wordpress: - image: wordpress - depends_on: - - db - expose: - - port: 80 - http_options: - max_body_size: 104857600 - # accept: - # - "example.com" - to: - - global: true - env: - - WORDPRESS_DB_HOST=db - - WORDPRESS_DB_USER=wordpress - - WORDPRESS_DB_PASSWORD=testpass4you - - WORDPRESS_DB_NAME=wordpress - params: - storage: - wordpress-data: - mount: /var/www/html - readOnly: false - db: - # We use a mariadb image which supports both amd64 & arm64 architecture - image: mariadb:10.6.4 - # If you really want to use MySQL, uncomment the following line - #image: mysql:8.0.27 - expose: - - port: 3306 - to: - - service: wordpress - env: - - MYSQL_RANDOM_ROOT_PASSWORD=1 - - MYSQL_DATABASE=wordpress - - MYSQL_USER=wordpress - - MYSQL_PASSWORD=testpass4you - params: - storage: - wordpress-db: - mount: /var/lib/mysql - readOnly: false -profiles: - compute: - wordpress: - resources: - cpu: - units: 1 - memory: - size: 1Gi - storage: - - size: 1Gi - - name: wordpress-data - size: 1Gi - attributes: - persistent: true - class: beta3 - db: - resources: - cpu: - units: 1 - memory: - size: 1Gi - storage: - - size: 1Gi - - name: wordpress-db - size: 1Gi - attributes: - persistent: true - class: beta3 - placement: - akash: - pricing: - wordpress: - denom: uakt - amount: 10000 - db: - denom: uakt - amount: 10000 -deployment: - wordpress: - akash: - profile: wordpress - count: 1 - db: - akash: - profile: db - count: 1 diff --git a/sdl/coin.go b/sdl/coin.go deleted file mode 100644 index 70d1f02b04..0000000000 --- a/sdl/coin.go +++ /dev/null @@ -1,53 +0,0 @@ -package sdl - -import ( - "errors" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "gopkg.in/yaml.v3" -) - -// v2Coin is an alias sdk.Coin to allow our custom UnmarshalYAML -// for now it supports PoC when actual pricing is specified as two fields -// aka amount and denom. we let UnmarshalYAML to deal with that and put result -// into Value field. -// discussion https://github.com/akash-network/node/issues/771 -type v2Coin struct { - Value sdk.DecCoin `yaml:"-"` -} - -var errInvalidCoinAmount = errors.New("invalid coin amount") - -func (sdl *v2Coin) UnmarshalYAML(node *yaml.Node) error { - parsedCoin := struct { - Amount string `yaml:"amount"` - Denom string `yaml:"denom"` - }{} - - if err := node.Decode(&parsedCoin); err != nil { - return err - } - - amount, err := sdk.NewDecFromStr(parsedCoin.Amount) - if err != nil { - return err - } - - if amount.IsZero() { - return fmt.Errorf("%w: amount is zero", errInvalidCoinAmount) - } - - // Never pass negative amounts to cosmos SDK DecCoin - if amount.IsNegative() { - return fmt.Errorf("%w: amount %q is negative", errNegativeValue, amount.String()) - } - - coin := sdk.NewDecCoinFromDec(parsedCoin.Denom, amount) - - *sdl = v2Coin{ - Value: coin, - } - - return nil -} diff --git a/sdl/coin_test.go b/sdl/coin_test.go deleted file mode 100644 index e44dcdebd9..0000000000 --- a/sdl/coin_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package sdl - -import ( - "github.com/stretchr/testify/require" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" -) - -func TestPricing(t *testing.T) { - lessThanOne, err := sdk.NewDecFromStr("0.7") - require.NoError(t, err) - tests := []struct { - text string - value sdk.DecCoin - err bool - }{ - {"amount: 1\ndenom: uakt", sdk.NewDecCoin("uakt", sdk.NewInt(1)), false}, - {"amount: -1\ndenom: uakt", sdk.NewDecCoin("uakt", sdk.NewInt(1)), true}, - {"amount: 0.7\ndenom: uakt", sdk.NewDecCoinFromDec("uakt", lessThanOne), false}, - {"amount: -0.7\ndenom: uakt", sdk.NewDecCoin("uakt", sdk.NewInt(0)), true}, - } - - for idx, test := range tests { - buf := []byte(test.text) - obj := &v2Coin{} - - err := yaml.Unmarshal(buf, obj) - - if test.err { - assert.Error(t, err, "idx:%v text:`%v`", idx, test.text) - continue - } - - if !assert.NoError(t, err, "idx:%v text:`%v`", idx, test.text) { - continue - } - - assert.Equal(t, test.value, obj.Value, "idx:%v text:`%v`", idx, test.text) - } -} diff --git a/sdl/cpu.go b/sdl/cpu.go deleted file mode 100644 index 37560fb348..0000000000 --- a/sdl/cpu.go +++ /dev/null @@ -1,47 +0,0 @@ -package sdl - -import ( - "fmt" - "sort" - - "gopkg.in/yaml.v3" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -type v2CPUAttributes types.Attributes - -type v2ResourceCPU struct { - Units cpuQuantity `yaml:"units"` - Attributes v2CPUAttributes `yaml:"attributes,omitempty"` -} - -func (sdl *v2CPUAttributes) UnmarshalYAML(node *yaml.Node) error { - var attr v2CPUAttributes - - for i := 0; i+1 < len(node.Content); i += 2 { - var value string - switch node.Content[i].Value { - case "arch": - if err := node.Content[i+1].Decode(&value); err != nil { - return err - } - default: - return fmt.Errorf("unsupported cpu attribute \"%s\"", node.Content[i].Value) - } - - attr = append(attr, types.Attribute{ - Key: node.Content[i].Value, - Value: value, - }) - } - - // keys are unique in attributes parsed from sdl so don't need to use sort.SliceStable - sort.Slice(attr, func(i, j int) bool { - return attr[i].Key < attr[j].Key - }) - - *sdl = attr - - return nil -} diff --git a/sdl/cpu_test.go b/sdl/cpu_test.go deleted file mode 100644 index 2e896f1abd..0000000000 --- a/sdl/cpu_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package sdl - -import ( - "testing" - - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" -) - -func TestV2ResourceCPU_Valid(t *testing.T) { - var stream = ` -units: 0.1 -attributes: - arch: amd64 -` - var p v2ResourceCPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, cpuQuantity(100), p.Units) - require.Equal(t, 1, len(p.Attributes)) - require.Equal(t, "arch", p.Attributes[0].Key) - require.Equal(t, "amd64", p.Attributes[0].Value) -} diff --git a/sdl/expose.go b/sdl/expose.go deleted file mode 100644 index 23e26f96c1..0000000000 --- a/sdl/expose.go +++ /dev/null @@ -1,114 +0,0 @@ -package sdl - -import ( - "net/url" - "sort" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - "gopkg.in/yaml.v3" -) - -type v2Accept struct { - Items []string `yaml:"items,omitempty"` -} - -func (p *v2Accept) UnmarshalYAML(node *yaml.Node) error { - var accept []string - if err := node.Decode(&accept); err != nil { - return err - } - - for _, item := range accept { - if _, err := url.ParseRequestURI("http://" + item); err != nil { - return err - } - } - - p.Items = accept - - return nil -} - -func (sdl v2Exposes) toManifestExpose(endpointNames map[string]uint32) (manifest.ServiceExposes, error) { - exposeCount := 0 - for _, expose := range sdl { - if len(expose.To) > 0 { - exposeCount += len(expose.To) - } else { - exposeCount++ - } - } - - res := make(manifest.ServiceExposes, 0, exposeCount) - - for _, expose := range sdl { - exp, err := expose.toManifestExposes(endpointNames) - if err != nil { - return nil, err - } - - res = append(res, exp...) - } - - sort.Sort(res) - - return res, nil -} - -func (sdl v2Expose) toManifestExposes(endpointNames map[string]uint32) (manifest.ServiceExposes, error) { - exposeCount := len(sdl.To) - if exposeCount == 0 { - exposeCount = 1 - } - - res := make(manifest.ServiceExposes, 0, exposeCount) - - proto, err := manifest.ParseServiceProtocol(sdl.Proto) - if err != nil { - return nil, err - } - - httpOptions, err := sdl.HTTPOptions.asManifest() - if err != nil { - return nil, err - } - - if len(sdl.To) > 0 { - for _, to := range sdl.To { - // This value is created just so it can be passed to the utility function - expose := manifest.ServiceExpose{ - Service: to.Service, - Port: sdl.Port, - ExternalPort: sdl.As, - Proto: proto, - Global: to.Global, - Hosts: sdl.Accept.Items, - HTTPOptions: httpOptions, - IP: to.IP, - } - - // Check to see if an IP endpoint is also specified - if expose.Global && len(expose.IP) != 0 { - seqNo := endpointNames[expose.IP] - expose.EndpointSequenceNumber = seqNo - } - - res = append(res, expose) - } - } else { - expose := manifest.ServiceExpose{ - Service: "", - Port: sdl.Port, - ExternalPort: sdl.As, - Proto: proto, - Global: false, - Hosts: sdl.Accept.Items, - HTTPOptions: httpOptions, - IP: "", - } - - res = append(res, expose) - } - - return res, nil -} diff --git a/sdl/full_test.go b/sdl/full_test.go deleted file mode 100644 index 108710f330..0000000000 --- a/sdl/full_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package sdl - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestFull(t *testing.T) { - stream := ` -version: "2.0" -services: - web: - image: ghcr.io/akash-network/demo-app - expose: - - port: 80 - as: 80 - accept: - - hello.localhost - to: - - global: true - params: - storage: - data: - mount: "/var/lib/demo-app/data" -profiles: - compute: - web: - resources: - cpu: - units: 0.1 - attributes: - arch: amd64 - gpu: - units: 1 - attributes: - vendor: - nvidia: - - model: a100 - memory: - size: 16Mi - storage: - - size: 128Mi - - name: data - size: 1Gi - attributes: - persistent: true - class: default - placement: - westcoast: - attributes: - region: us-west - pricing: - web: - amount: 1 - denom: uakt -deployment: - web: - westcoast: - profile: web - count: 1 -` - - _, err := Read([]byte(stream)) - require.NoError(t, err) -} diff --git a/sdl/gpu.go b/sdl/gpu.go deleted file mode 100644 index 54833b347a..0000000000 --- a/sdl/gpu.go +++ /dev/null @@ -1,131 +0,0 @@ -package sdl - -import ( - "fmt" - "sort" - - "gopkg.in/yaml.v3" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -type gpuInterface string - -type v2GPUNvidia struct { - Model string `yaml:"model"` - RAM *memoryQuantity `yaml:"ram,omitempty"` - Interface *gpuInterface `yaml:"interface,omitempty"` -} - -func (sdl *v2GPUNvidia) String() string { - key := sdl.Model - if sdl.RAM != nil { - key = fmt.Sprintf("%s/ram/%s", key, sdl.RAM.StringWithSuffix("Gi")) - } - - if sdl.Interface != nil { - key = fmt.Sprintf("%s/interface/%s", key, *sdl.Interface) - } - - return key -} - -type v2GPUsNvidia []v2GPUNvidia - -type gpuVendor struct { - Nvidia v2GPUsNvidia `yaml:"nvidia,omitempty"` -} - -type v2GPUAttributes types.Attributes - -type v2ResourceGPU struct { - Units gpuQuantity `yaml:"units" json:"units"` - Attributes v2GPUAttributes `yaml:"attributes,omitempty" json:"attributes,omitempty"` -} - -func (sdl *v2ResourceGPU) UnmarshalYAML(node *yaml.Node) error { - res := v2ResourceGPU{} - - for i := 0; i < len(node.Content); i += 2 { - switch node.Content[i].Value { - case "units": - if err := node.Content[i+1].Decode(&res.Units); err != nil { - return err - } - case "attributes": - if err := node.Content[i+1].Decode(&res.Attributes); err != nil { - return err - } - default: - return fmt.Errorf("sdl: unsupported field (%s) for GPU resource", node.Content[i].Value) - } - } - - if res.Units > 0 && len(res.Attributes) == 0 { - return fmt.Errorf("sdl: GPU attributes must be present if units > 0") - } - - *sdl = res - - return nil -} - -func (sdl *v2GPUAttributes) UnmarshalYAML(node *yaml.Node) error { - var res types.Attributes - - var vendor *gpuVendor - - for i := 0; i < len(node.Content); i += 2 { - switch node.Content[i].Value { - case "vendor": - if err := node.Content[i+1].Decode(&vendor); err != nil { - return err - } - default: - return fmt.Errorf("sdl: unsupported attribute (%s) for GPU resource", node.Content[i].Value) - } - } - - if vendor == nil { - return fmt.Errorf("sdl: invalid GPU attributes. at least one vendor must be set") - } - - res = make(types.Attributes, 0, len(vendor.Nvidia)) - - for _, model := range vendor.Nvidia { - res = append(res, types.Attribute{ - Key: fmt.Sprintf("vendor/nvidia/model/%s", model.String()), - Value: "true", - }) - } - - if len(res) == 0 { - res = append(res, types.Attribute{ - Key: "vendor/nvidia/model/*", - Value: "true", - }) - } - - sort.Sort(res) - - if err := res.Validate(); err != nil { - return fmt.Errorf("sdl: invalid GPU attributes: %w", err) - } - - *sdl = v2GPUAttributes(res) - - return nil -} - -func (sdl *gpuInterface) UnmarshalYAML(node *yaml.Node) error { - switch node.Value { - case "pcie": - case "sxm": - default: - return fmt.Errorf("sdl: invalid GPU interface %s. expected \"pcie|sxm\"", node.Value) - } - - *sdl = gpuInterface(node.Value) - - return nil -} diff --git a/sdl/gpu_test.go b/sdl/gpu_test.go deleted file mode 100644 index 8277fbc760..0000000000 --- a/sdl/gpu_test.go +++ /dev/null @@ -1,190 +0,0 @@ -package sdl - -import ( - "testing" - - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" -) - -func TestV2ResourceGPU_EmptyVendor(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.Error(t, err) -} - -func TestV2ResourceGPU_Wildcard(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, gpuQuantity(1), p.Units) - require.Equal(t, 1, len(p.Attributes)) - require.Equal(t, "vendor/nvidia/model/*", p.Attributes[0].Key) - require.Equal(t, "true", p.Attributes[0].Value) -} - -func TestV2ResourceGPU_SingleModel(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a100 -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, gpuQuantity(1), p.Units) - require.Equal(t, 1, len(p.Attributes)) - require.Equal(t, "vendor/nvidia/model/a100", p.Attributes[0].Key) - require.Equal(t, "true", p.Attributes[0].Value) -} - -func TestV2ResourceGPU_SingleModelWithRAM(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a100 - ram: 80Gi -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, gpuQuantity(1), p.Units) - require.Equal(t, 1, len(p.Attributes)) - require.Equal(t, "vendor/nvidia/model/a100/ram/80Gi", p.Attributes[0].Key) - require.Equal(t, "true", p.Attributes[0].Value) -} - -func TestV2ResourceGPU_InvalidRAMUnit(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a100 - ram: 80G -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.Error(t, err) -} - -func TestV2ResourceGPU_InterfaceInvalid(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a100 - interface: pciex -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.Error(t, err) -} - -func TestV2ResourceGPU_RamWithInterface(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a100 - ram: 80Gi - interface: pcie -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, gpuQuantity(1), p.Units) - require.Equal(t, 1, len(p.Attributes)) - require.Equal(t, "vendor/nvidia/model/a100/ram/80Gi/interface/pcie", p.Attributes[0].Key) - require.Equal(t, "true", p.Attributes[0].Value) -} - -func TestV2ResourceGPU_MultipleModels(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a100 - ram: 80Gi - - model: a100 - ram: 40Gi -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, gpuQuantity(1), p.Units) - require.Equal(t, 2, len(p.Attributes)) - require.Equal(t, "vendor/nvidia/model/a100/ram/40Gi", p.Attributes[0].Key) - require.Equal(t, "true", p.Attributes[0].Value) - require.Equal(t, "vendor/nvidia/model/a100/ram/80Gi", p.Attributes[1].Key) - require.Equal(t, "true", p.Attributes[1].Value) -} - -func TestV2ResourceGPU_MultipleModels2(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a100 - ram: 80Gi - - model: a100 -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, gpuQuantity(1), p.Units) - require.Equal(t, 2, len(p.Attributes)) - require.Equal(t, "vendor/nvidia/model/a100", p.Attributes[0].Key) - require.Equal(t, "true", p.Attributes[0].Value) - require.Equal(t, "vendor/nvidia/model/a100/ram/80Gi", p.Attributes[1].Key) - require.Equal(t, "true", p.Attributes[1].Value) -} - -func TestV2ResourceGPU_MultipleModels3(t *testing.T) { - var stream = ` -units: 1 -attributes: - vendor: - nvidia: - - model: a6000 - - model: a40 -` - var p v2ResourceGPU - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Equal(t, gpuQuantity(1), p.Units) - require.Equal(t, 2, len(p.Attributes)) - require.Equal(t, "vendor/nvidia/model/a40", p.Attributes[0].Key) - require.Equal(t, "true", p.Attributes[0].Value) - require.Equal(t, "vendor/nvidia/model/a6000", p.Attributes[1].Key) - require.Equal(t, "true", p.Attributes[1].Value) -} diff --git a/sdl/groupBuilder_v2.go b/sdl/groupBuilder_v2.go deleted file mode 100644 index 3d9911ed46..0000000000 --- a/sdl/groupBuilder_v2.go +++ /dev/null @@ -1,149 +0,0 @@ -package sdl - -import ( - "sort" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -type groupsBuilderV2 struct { - dgroup *dtypes.GroupSpec - mgroup *manifest.Group - boundComputes map[string]map[string]int -} - -// buildGroups -func (sdl *v2) buildGroups() error { - endpointsNames := sdl.computeEndpointSequenceNumbers() - - groups := make(map[string]*groupsBuilderV2) - - for _, svcName := range sdl.Deployments.svcNames() { - depl := sdl.Deployments[svcName] - - for _, placementName := range depl.placementNames() { - // objects below have been ensured to exist - svcdepl := depl[placementName] - compute := sdl.Profiles.Compute[svcdepl.Profile] - svc := sdl.Services[svcName] - infra := sdl.Profiles.Placement[placementName] - price := infra.Pricing[svcdepl.Profile] - - group := groups[placementName] - - if group == nil { - group = &groupsBuilderV2{ - dgroup: &dtypes.GroupSpec{ - Name: placementName, - }, - mgroup: &manifest.Group{ - Name: placementName, - }, - boundComputes: make(map[string]map[string]int), - } - - group.dgroup.Requirements.Attributes = types.Attributes(infra.Attributes) - group.dgroup.Requirements.SignedBy = infra.SignedBy - - // keep ordering stable - sort.Sort(group.dgroup.Requirements.Attributes) - - groups[placementName] = group - } - - if _, exists := group.boundComputes[placementName]; !exists { - group.boundComputes[placementName] = make(map[string]int) - } - - expose, err := sdl.Services[svcName].Expose.toManifestExpose(endpointsNames) - if err != nil { - return err - } - - resources := compute.Resources.toResources() - resources.Endpoints = expose.GetEndpoints() - - res := compute.Resources.toResources() - res.Endpoints = expose.GetEndpoints() - - var resID int - if ln := len(group.dgroup.Resources); ln > 0 { - resID = ln + 1 - } else { - resID = 1 - } - - res.ID = uint32(resID) - resources.ID = res.ID - - group.dgroup.Resources = append(group.dgroup.Resources, dtypes.ResourceUnit{ - Resources: res, - Price: price.Value, - Count: svcdepl.Count, - }) - - group.boundComputes[placementName][svcdepl.Profile] = len(group.dgroup.Resources) - 1 - - msvc := manifest.Service{ - Name: svcName, - Image: svc.Image, - Args: svc.Args, - Env: svc.Env, - Resources: resources, - Count: svcdepl.Count, - Command: svc.Command, - Expose: expose, - } - - if svc.Params != nil { - params := &manifest.ServiceParams{} - - if len(svc.Params.Storage) > 0 { - params.Storage = make([]manifest.StorageParams, 0, len(svc.Params.Storage)) - for volName, volParams := range svc.Params.Storage { - params.Storage = append(params.Storage, manifest.StorageParams{ - Name: volName, - Mount: volParams.Mount, - ReadOnly: volParams.ReadOnly, - }) - } - } - - msvc.Params = params - } - - if svc.Credentials != nil { - msvc.Credentials = &manifest.ServiceImageCredentials{ - Host: svc.Credentials.Host, - Username: svc.Credentials.Username, - Password: svc.Credentials.Password, - } - } - - group.mgroup.Services = append(group.mgroup.Services, msvc) - } - } - - // keep ordering stable - names := make([]string, 0, len(groups)) - for name := range groups { - names = append(names, name) - } - sort.Strings(names) - - sdl.result.dgroups = make(dtypes.GroupSpecs, 0, len(names)) - sdl.result.mgroups = make(manifest.Groups, 0, len(names)) - - for _, name := range names { - mgroup := *groups[name].mgroup - // stable ordering services by name - sort.Sort(mgroup.Services) - - sdl.result.dgroups = append(sdl.result.dgroups, groups[name].dgroup) - sdl.result.mgroups = append(sdl.result.mgroups, mgroup) - } - - return nil -} diff --git a/sdl/groupBuilder_v2_1.go b/sdl/groupBuilder_v2_1.go deleted file mode 100644 index e39143449e..0000000000 --- a/sdl/groupBuilder_v2_1.go +++ /dev/null @@ -1,160 +0,0 @@ -package sdl - -import ( - "sort" - "strings" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -type groupsBuilderV2_1 struct { - dgroup *dtypes.GroupSpec - mgroup *manifest.Group - boundComputes map[string]map[string]int -} - -// buildGroups -func (sdl *v2_1) buildGroups() error { - endpointsNames := sdl.computeEndpointSequenceNumbers() - - groups := make(map[string]*groupsBuilderV2_1) - - for _, svcName := range sdl.Deployments.svcNames() { - depl := sdl.Deployments[svcName] - - for _, placementName := range depl.placementNames() { - // objects below have been ensured to exist - svcdepl := depl[placementName] - compute := sdl.Profiles.Compute[svcdepl.Profile] - svc := sdl.Services[svcName] - infra := sdl.Profiles.Placement[placementName] - price := infra.Pricing[svcdepl.Profile] - - group := groups[placementName] - - if group == nil { - group = &groupsBuilderV2_1{ - dgroup: &dtypes.GroupSpec{ - Name: placementName, - }, - mgroup: &manifest.Group{ - Name: placementName, - }, - boundComputes: make(map[string]map[string]int), - } - - group.dgroup.Requirements.Attributes = types.Attributes(infra.Attributes) - group.dgroup.Requirements.SignedBy = infra.SignedBy - - // keep ordering stable - sort.Sort(group.dgroup.Requirements.Attributes) - - groups[placementName] = group - } - - if _, exists := group.boundComputes[placementName]; !exists { - group.boundComputes[placementName] = make(map[string]int) - } - - expose, err := sdl.Services[svcName].Expose.toManifestExpose(endpointsNames) - if err != nil { - return err - } - - resources := compute.Resources.toResources() - resources.Endpoints = expose.GetEndpoints() - - if location, bound := group.boundComputes[placementName][svcdepl.Profile]; !bound { - res := compute.Resources.toResources() - res.Endpoints = expose.GetEndpoints() - - var resID int - if ln := len(group.dgroup.Resources); ln > 0 { - resID = ln + 1 - } else { - resID = 1 - } - - res.ID = uint32(resID) - resources.ID = res.ID - - group.dgroup.Resources = append(group.dgroup.Resources, dtypes.ResourceUnit{ - Resources: res, - Price: price.Value, - Count: svcdepl.Count, - }) - - group.boundComputes[placementName][svcdepl.Profile] = len(group.dgroup.Resources) - 1 - } else { - resources.ID = group.dgroup.Resources[location].ID - - group.dgroup.Resources[location].Count += svcdepl.Count - group.dgroup.Resources[location].Endpoints = append(group.dgroup.Resources[location].Endpoints, expose.GetEndpoints()...) - - sort.Sort(group.dgroup.Resources[location].Endpoints) - } - - msvc := manifest.Service{ - Name: svcName, - Image: svc.Image, - Args: svc.Args, - Env: svc.Env, - Resources: resources, - Count: svcdepl.Count, - Command: svc.Command, - Expose: expose, - } - - if svc.Params != nil { - params := &manifest.ServiceParams{} - - if len(svc.Params.Storage) > 0 { - params.Storage = make([]manifest.StorageParams, 0, len(svc.Params.Storage)) - for volName, volParams := range svc.Params.Storage { - params.Storage = append(params.Storage, manifest.StorageParams{ - Name: volName, - Mount: volParams.Mount, - ReadOnly: volParams.ReadOnly, - }) - } - } - - msvc.Params = params - } - - if svc.Credentials != nil { - msvc.Credentials = &manifest.ServiceImageCredentials{ - Host: strings.TrimSpace(svc.Credentials.Host), - Email: strings.TrimSpace(svc.Credentials.Email), - Username: strings.TrimSpace(svc.Credentials.Username), - Password: strings.TrimSpace(svc.Credentials.Password), - } - } - - group.mgroup.Services = append(group.mgroup.Services, msvc) - } - } - - // keep ordering stable - names := make([]string, 0, len(groups)) - for name := range groups { - names = append(names, name) - } - sort.Strings(names) - - sdl.result.dgroups = make(dtypes.GroupSpecs, 0, len(names)) - sdl.result.mgroups = make(manifest.Groups, 0, len(names)) - - for _, name := range names { - mgroup := *groups[name].mgroup - // stable ordering services by name - sort.Sort(mgroup.Services) - - sdl.result.dgroups = append(sdl.result.dgroups, groups[name].dgroup) - sdl.result.mgroups = append(sdl.result.mgroups, mgroup) - } - - return nil -} diff --git a/sdl/memory.go b/sdl/memory.go deleted file mode 100644 index af55ffb82f..0000000000 --- a/sdl/memory.go +++ /dev/null @@ -1,42 +0,0 @@ -package sdl - -import ( - "sort" - - "gopkg.in/yaml.v3" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -type v2MemoryAttributes types.Attributes - -type v2ResourceMemory struct { - Quantity byteQuantity `yaml:"size"` - Attributes v2MemoryAttributes `yaml:"-"` -} - -func (sdl *v2MemoryAttributes) UnmarshalYAML(node *yaml.Node) error { - var attr v2MemoryAttributes - - var res map[string]string - - if err := node.Decode(&res); err != nil { - return err - } - - for k, v := range res { - attr = append(attr, types.Attribute{ - Key: k, - Value: v, - }) - } - - // keys are unique in attributes parsed from sdl so don't need to use sort.SliceStable - sort.Slice(attr, func(i, j int) bool { - return attr[i].Key < attr[j].Key - }) - - *sdl = attr - - return nil -} diff --git a/sdl/placement.go b/sdl/placement.go deleted file mode 100644 index a935862573..0000000000 --- a/sdl/placement.go +++ /dev/null @@ -1,37 +0,0 @@ -package sdl - -import ( - "sort" - - "gopkg.in/yaml.v3" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -type v2PlacementAttributes types.Attributes - -func (sdl *v2PlacementAttributes) UnmarshalYAML(node *yaml.Node) error { - var attr v2PlacementAttributes - - var res map[string]string - - if err := node.Decode(&res); err != nil { - return err - } - - for k, v := range res { - attr = append(attr, types.Attribute{ - Key: k, - Value: v, - }) - } - - // keys are unique in attributes parsed from sdl so don't need to use sort.SliceStable - sort.Slice(attr, func(i, j int) bool { - return attr[i].Key < attr[j].Key - }) - - *sdl = attr - - return nil -} diff --git a/sdl/pricing.go b/sdl/pricing.go deleted file mode 100644 index db2f19781c..0000000000 --- a/sdl/pricing.go +++ /dev/null @@ -1,4 +0,0 @@ -package sdl - -// todo should pricing values be in form of range? -type v2PlacementPricing map[string]v2Coin diff --git a/sdl/resources.go b/sdl/resources.go deleted file mode 100644 index 2efa9f5fd2..0000000000 --- a/sdl/resources.go +++ /dev/null @@ -1,59 +0,0 @@ -package sdl - -import ( - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -type v2ComputeResources struct { - CPU *v2ResourceCPU `yaml:"cpu"` - GPU *v2ResourceGPU `yaml:"gpu"` - Memory *v2ResourceMemory `yaml:"memory"` - Storage v2ResourceStorageArray `yaml:"storage"` -} - -func (sdl *v2ComputeResources) toResources() types.Resources { - if sdl == nil { - return types.Resources{} - } - - units := types.Resources{ - Endpoints: types.Endpoints{}, - } - - if sdl.CPU != nil { - units.CPU = &types.CPU{ - Units: types.NewResourceValue(uint64(sdl.CPU.Units)), - Attributes: types.Attributes(sdl.CPU.Attributes), - } - } - - if sdl.GPU != nil { - units.GPU = &types.GPU{ - Units: types.NewResourceValue(uint64(sdl.GPU.Units)), - Attributes: types.Attributes(sdl.GPU.Attributes), - } - } else { - units.GPU = &types.GPU{ - Units: types.NewResourceValue(0), - } - } - - if sdl.Memory != nil { - units.Memory = &types.Memory{ - Quantity: types.NewResourceValue(uint64(sdl.Memory.Quantity)), - Attributes: types.Attributes(sdl.Memory.Attributes), - } - } - - for _, storage := range sdl.Storage { - storageEntry := types.Storage{ - Name: storage.Name, - Quantity: types.NewResourceValue(uint64(storage.Quantity)), - Attributes: types.Attributes(storage.Attributes), - } - - units.Storage = append(units.Storage, storageEntry) - } - - return units -} diff --git a/sdl/sdl.go b/sdl/sdl.go deleted file mode 100644 index bb4bf398ab..0000000000 --- a/sdl/sdl.go +++ /dev/null @@ -1,159 +0,0 @@ -package sdl - -import ( - "errors" - "fmt" - "os" - - "github.com/blang/semver/v4" - "gopkg.in/yaml.v3" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" -) - -const ( - sdlVersionField = "version" -) - -var ( - errUninitializedConfig = errors.New("sdl: uninitialized") - errSDLInvalidNoVersion = fmt.Errorf("%w: no version found", errSDLInvalid) -) - -// SDL is the interface which wraps Validate, Deployment and Manifest methods -type SDL interface { - DeploymentGroups() (dtypes.GroupSpecs, error) - Manifest() (manifest.Manifest, error) - Version() ([]byte, error) - validate() error -} - -var _ SDL = (*sdl)(nil) - -type sdl struct { - Ver semver.Version `yaml:"version,-"` - data SDL `yaml:"-"` -} - -func (s *sdl) UnmarshalYAML(node *yaml.Node) error { - var result sdl - - foundVersion := false - for idx := range node.Content { - if node.Content[idx].Value == sdlVersionField { - var err error - if result.Ver, err = semver.ParseTolerant(node.Content[idx+1].Value); err != nil { - return err - } - foundVersion = true - break - } - } - - if !foundVersion { - return errSDLInvalidNoVersion - } - - // nolint: gocritic - if result.Ver.EQ(semver.MustParse("2.0.0")) { - var decoded v2 - if err := node.Decode(&decoded); err != nil { - return err - } - - result.data = &decoded - } else if result.Ver.GE(semver.MustParse("2.1.0")) { - var decoded v2_1 - if err := node.Decode(&decoded); err != nil { - return err - } - - result.data = &decoded - } else { - return fmt.Errorf("%w: config: unsupported version %q", errSDLInvalid, result.Ver) - } - - *s = result - - return nil -} - -// ReadFile read from given path and returns SDL instance -func ReadFile(path string) (SDL, error) { - buf, err := os.ReadFile(path) - if err != nil { - return nil, err - } - return Read(buf) -} - -// Read reads buffer data and returns SDL instance -func Read(buf []byte) (SDL, error) { - obj := &sdl{} - if err := yaml.Unmarshal(buf, obj); err != nil { - return nil, err - } - - if err := obj.validate(); err != nil { - return nil, err - } - - dgroups, err := obj.DeploymentGroups() - if err != nil { - return nil, err - } - - vgroups := make([]dtypes.GroupSpec, 0, len(dgroups)) - for _, dgroup := range dgroups { - vgroups = append(vgroups, *dgroup) - } - - if err := dtypes.ValidateDeploymentGroups(vgroups); err != nil { - return nil, err - } - - m, err := obj.Manifest() - if err != nil { - return nil, err - } - - if err := m.Validate(); err != nil { - return nil, err - } - - return obj, nil -} - -// Version creates the deterministic Deployment Version hash from the SDL. -func (s *sdl) Version() ([]byte, error) { - if s.data == nil { - return nil, errUninitializedConfig - } - - return s.data.Version() -} - -func (s *sdl) DeploymentGroups() (dtypes.GroupSpecs, error) { - if s.data == nil { - return dtypes.GroupSpecs{}, errUninitializedConfig - } - - return s.data.DeploymentGroups() -} - -func (s *sdl) Manifest() (manifest.Manifest, error) { - if s.data == nil { - return manifest.Manifest{}, errUninitializedConfig - } - - return s.data.Manifest() -} - -func (s *sdl) validate() error { - if s.data == nil { - return errUninitializedConfig - } - - return s.data.validate() -} diff --git a/sdl/sdl_test.go b/sdl/sdl_test.go deleted file mode 100644 index 2cc5821b96..0000000000 --- a/sdl/sdl_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package sdl - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestSDLManifestVersion(t *testing.T) { - obj, err := ReadFile("_testdata/simple.yaml") - require.NoError(t, err) - - m, err := obj.Manifest() - require.NoError(t, err) - - version, err := m.Version() - require.NoError(t, err) - // Should return a value - require.NotEmpty(t, version) - - obj, err = ReadFile("_testdata/private_service.yaml") - require.NoError(t, err) - - m, err = obj.Manifest() - require.NoError(t, err) - - secondVersion, err := m.Version() - require.NoError(t, err) - // Should return a value - require.NotEmpty(t, secondVersion) - // Should be different from the first - require.NotEqual(t, secondVersion, version) -} - -func TestSDLManifestVersionChangesWithVersion(t *testing.T) { - obj, err := ReadFile("_testdata/simple.yaml") - require.NoError(t, err) - - m, err := obj.Manifest() - require.NoError(t, err) - - version, err := m.Version() - require.NoError(t, err) - // Should return a value - require.NotEmpty(t, version) - - obj, err = ReadFile("_testdata/simple-double-ram.yaml") - require.NoError(t, err) - - m, err = obj.Manifest() - require.NoError(t, err) - - secondVersion, err := m.Version() - require.NoError(t, err) - // Should return a value - require.NotEmpty(t, secondVersion) - // Should be different from the first - require.NotEqual(t, secondVersion, version) -} diff --git a/sdl/storage.go b/sdl/storage.go deleted file mode 100644 index a591b4b347..0000000000 --- a/sdl/storage.go +++ /dev/null @@ -1,251 +0,0 @@ -package sdl - -import ( - "errors" - "fmt" - "sort" - - "gopkg.in/yaml.v3" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -const ( - StorageEphemeral = "ephemeral" - StorageAttributePersistent = "persistent" - StorageAttributeClass = "class" - StorageAttributeMount = "mount" - StorageAttributeReadOnly = "readOnly" // we might not need it at this point of time - StorageClassDefault = "default" - StorageClassRAM = "ram" -) - -var ( - errUnsupportedStorageAttribute = errors.New("sdl: unsupported storage attribute") - errStorageDupMountPoint = errors.New("sdl: duplicated mount point") - errStorageMultipleRootEphemeral = errors.New("sdl: multiple root ephemeral storages are not allowed") - errStorageDuplicatedVolumeName = errors.New("sdl: duplicated volume name") - errStorageEphemeralClass = errors.New("sdl: ephemeral storage should not set attribute class") - errStorageRAMClass = errors.New("sdl: ram storage class cannot be persistent") -) - -type v2StorageAttributes types.Attributes - -type v2ServiceStorageParams struct { - Mount string `yaml:"mount"` - ReadOnly bool `yaml:"readOnly"` -} - -type v2ResourceStorage struct { - Name string `yaml:"name"` - Quantity byteQuantity `yaml:"size"` - Attributes v2StorageAttributes `yaml:"attributes,omitempty"` -} - -type v2ResourceStorageArray []v2ResourceStorage - -type validateAttrFn func(string, *string) error - -var allowedStorageClasses = map[string]bool{ - "default": true, - "beta1": true, - "beta2": true, - "beta3": true, - StorageClassRAM: true, -} - -var validateStorageAttributes = map[string]validateAttrFn{ - StorageAttributePersistent: validateAttributeBool, - StorageAttributeClass: validateAttributeStorageClass, -} - -func validateAttributeBool(key string, val *string) error { - if res, valid := unifyStringAsBool(*val); valid { - *val = res - - return nil - } - - return fmt.Errorf("sdl: invalid value for attribute \"%s\". expected bool", key) -} - -func validateAttributeStorageClass(_ string, val *string) error { - if _, valid := allowedStorageClasses[*val]; valid { - return nil - } - - return fmt.Errorf("sdl: invalid value for attribute class") -} - -// UnmarshalYAML unmarshal storage config -// data can be present either as single entry mapping or an array of them -// nolint: gofmt -// e.g -// single entity -// ```yaml -// storage: -// -// size: 1Gi -// attributes: -// class: ssd -// -// ``` -// -// ```yaml -// storage: -// - size: 512Mi # ephemeral storage -// - size: 1Gi -// name: cache -// attributes: -// class: ssd -// - size: 100Gi -// name: data -// attributes: -// persistent: true # this volumes survives pod restart -// class: gp # aka general purpose -// -// ``` -func (sdl *v2ResourceStorageArray) UnmarshalYAML(node *yaml.Node) error { - var nodes v2ResourceStorageArray - - switch node.Kind { - case yaml.SequenceNode: - for _, content := range node.Content { - var nd v2ResourceStorage - if err := content.Decode(&nd); err != nil { - return err - } - - // set default name to ephemeral. later in validation error thrown if multiple - if nd.Name == "" { - nd.Name = "default" - } - nodes = append(nodes, nd) - } - case yaml.MappingNode: - var nd v2ResourceStorage - if err := node.Decode(&nd); err != nil { - return err - } - - nd.Name = "default" - nodes = append(nodes, nd) - } - - // check for duplicated volume names - names := make(map[string]string) - for _, nd := range nodes { - if _, exists := names[nd.Name]; exists { - return errStorageDuplicatedVolumeName - } - - names[nd.Name] = nd.Name - } - - nodes.sort() - - *sdl = nodes - - return nil -} - -func (sdl *v2StorageAttributes) UnmarshalYAML(node *yaml.Node) error { - var attr v2StorageAttributes - - var res map[string]string - - if err := node.Decode(&res); err != nil { - return err - } - - // set default - if _, set := res[StorageAttributePersistent]; !set { - res[StorageAttributePersistent] = valueFalse - } - - persistent := res[StorageAttributePersistent] - class := res[StorageAttributeClass] - - switch class { - case "": - if persistent == valueTrue { - res[StorageAttributeClass] = StorageClassDefault - } - case StorageClassRAM: - if persistent != valueFalse { - return errStorageRAMClass - } - default: - if persistent == valueFalse { - return errStorageEphemeralClass - } - } - - for k, v := range res { - validateFn, supportedAttr := validateStorageAttributes[k] - if !supportedAttr { - return fmt.Errorf("%w: %s", errUnsupportedStorageAttribute, k) - } - - val := v - if err := validateFn(k, &val); err != nil { - return err - } - - attr = append(attr, types.Attribute{ - Key: k, - Value: val, - }) - } - - // at this point keys are unique in attributes parsed from sdl so don't need to use sort.SliceStable - sort.Slice(attr, func(i, j int) bool { - return attr[i].Key < attr[j].Key - }) - - *sdl = attr - - return nil -} - -// sort storage slice in the following order -// 1. smaller size -// 2. if sizes are equal then one without class goes up -// 3. when both class present use lexicographic order -// 4. if no class in both cases check persistent attribute. one persistent = false goes up -// 5. volume name -func (sdl v2ResourceStorageArray) sort() { - sort.SliceStable(sdl, func(i, j int) bool { - if sdl[i].Quantity < sdl[j].Quantity { - return true - } - - if sdl[i].Quantity > sdl[j].Quantity { - return false - } - - iAttr := types.Attributes(sdl[i].Attributes) - jAttr := types.Attributes(sdl[j].Attributes) - - iClass, iExists := iAttr.Find(StorageAttributePersistent).AsString() - jClass, jExists := jAttr.Find(StorageAttributePersistent).AsString() - - if (!iExists && jExists) || - (jExists && iExists && iClass < jClass) { - return true - } else if iExists && !jExists { - return false - } - - iPersistent, _ := iAttr.Find(StorageAttributePersistent).AsBool() - jPersistent, _ := jAttr.Find(StorageAttributePersistent).AsBool() - - if !iPersistent { - return true - } else if !jPersistent { - return false - } - - return sdl[i].Name < sdl[j].Name - }) -} diff --git a/sdl/storage_test.go b/sdl/storage_test.go deleted file mode 100644 index b60c35f2d9..0000000000 --- a/sdl/storage_test.go +++ /dev/null @@ -1,229 +0,0 @@ -package sdl - -import ( - "testing" - - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" - - "github.com/akash-network/akash-api/go/node/types/unit" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -func TestStorage_LegacyValid(t *testing.T) { - var stream = ` -size: 1Gi -` - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - - require.Len(t, p, 1) - require.Equal(t, byteQuantity(1*unit.Gi), p[0].Quantity) - require.Len(t, p[0].Attributes, 0) -} - -func TestStorage_ArraySingleElemValid(t *testing.T) { - var stream = ` -- size: 1Gi -` - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - - require.Len(t, p, 1) - require.Equal(t, byteQuantity(1*unit.Gi), p[0].Quantity) - require.Len(t, p[0].Attributes, 0) -} - -func TestStorage_AttributesPersistentValidClass(t *testing.T) { - var stream = ` -- size: 1Gi - attributes: - persistent: true - class: default -` - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - - require.Len(t, p, 1) - require.Equal(t, byteQuantity(1*unit.Gi), p[0].Quantity) - require.Len(t, p[0].Attributes, 2) - - attr := types.Attributes(p[0].Attributes) - require.Equal(t, attr[0].Key, "class") - require.Equal(t, attr[0].Value, "default") -} - -func TestStorage_AttributesUnknown(t *testing.T) { - var stream = ` -- size: 1Gi - attributes: - somefield: foo -` - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.ErrorIs(t, err, errUnsupportedStorageAttribute) -} - -func TestStorage_MultipleUnnamedEphemeral(t *testing.T) { - var stream = ` -- size: 1Gi -- size: 2Gi -` - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.EqualError(t, err, errStorageDuplicatedVolumeName.Error()) -} - -func TestStorage_EphemeralNoClass(t *testing.T) { - var stream = ` -- size: 1Gi -` - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) -} - -func TestStorage_EphemeralClass(t *testing.T) { - var stream = ` -- size: 1Gi - attributes: - class: foo -` - - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.EqualError(t, err, errStorageEphemeralClass.Error()) -} - -func TestStorage_PersistentDefaultClass(t *testing.T) { - var stream = ` -- size: 1Gi - attributes: - persistent: true -` - - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Len(t, p[0].Attributes, 2) - - require.Equal(t, p[0].Attributes[0].Key, "class") - require.Equal(t, p[0].Attributes[0].Value, "default") -} - -func TestStorage_PersistentClass(t *testing.T) { - var stream = ` -- size: 1Gi - attributes: - persistent: true - class: beta1 -` - - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Len(t, p[0].Attributes, 2) - - require.Equal(t, p[0].Attributes[0].Key, "class") - require.Equal(t, p[0].Attributes[0].Value, "beta1") -} - -func TestStorage_RAMClass_Valid(t *testing.T) { - var stream = ` -- size: 1Gi - attributes: - persistent: false - class: ram -` - - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) - require.Len(t, p[0].Attributes, 2) - - require.Equal(t, p[0].Attributes[0].Key, "class") - require.Equal(t, p[0].Attributes[0].Value, "ram") -} - -func TestStorage_RamClass_Invalid(t *testing.T) { - var stream = ` -- size: 1Gi - attributes: - persistent: true - class: ram -` - - var p v2ResourceStorageArray - - err := yaml.Unmarshal([]byte(stream), &p) - require.Error(t, err) -} - -func TestStorage_StableSort(t *testing.T) { - storage := v2ResourceStorageArray{ - { - Quantity: 2 * unit.Gi, - Attributes: v2StorageAttributes{ - types.Attribute{ - Key: "persistent", - Value: "true", - }, - }, - }, - { - Quantity: 1 * unit.Gi, - }, - { - Quantity: 10 * unit.Gi, - }, - } - - storage.sort() - - require.Equal(t, byteQuantity(1*unit.Gi), storage[0].Quantity) - require.Equal(t, byteQuantity(2*unit.Gi), storage[1].Quantity) - require.Equal(t, byteQuantity(10*unit.Gi), storage[2].Quantity) -} - -func TestStorage_Invalid_InvalidMount(t *testing.T) { - _, err := ReadFile("./_testdata/storageClass1.yaml") - require.Error(t, err) - require.Contains(t, err.Error(), "expected absolute path") -} - -func TestStorage_Invalid_MountNotAbsolute(t *testing.T) { - _, err := ReadFile("./_testdata/storageClass2.yaml") - require.Error(t, err) - require.Contains(t, err.Error(), "expected absolute path") -} - -func TestStorage_Invalid_VolumeReference(t *testing.T) { - _, err := ReadFile("./_testdata/storageClass3.yaml") - require.Error(t, err) - require.Contains(t, err.Error(), "references to no-existing compute volume") -} - -func TestStorage_Invalid_DuplicatedMount(t *testing.T) { - _, err := ReadFile("./_testdata/storageClass4.yaml") - require.Error(t, err) - require.Contains(t, err.Error(), "already in use by volume") -} - -func TestStorage_Invalid_NoMount(t *testing.T) { - _, err := ReadFile("./_testdata/storageClass5.yaml") - require.Error(t, err) - require.Contains(t, err.Error(), "to have mount") -} diff --git a/sdl/units.go b/sdl/units.go deleted file mode 100644 index d158e44214..0000000000 --- a/sdl/units.go +++ /dev/null @@ -1,154 +0,0 @@ -package sdl - -import ( - "fmt" - "strconv" - "strings" - - "gopkg.in/yaml.v3" - - "github.com/akash-network/akash-api/go/node/types/unit" -) - -var ( - errNegativeValue = fmt.Errorf("invalid: negative value not allowed") -) - -var unitSuffixes = map[string]uint64{ - "k": unit.K, - "Ki": unit.Ki, - "M": unit.M, - "Mi": unit.Mi, - "G": unit.G, - "Gi": unit.Gi, - "T": unit.T, - "Ti": unit.Ti, - "P": unit.P, - "Pi": unit.Pi, - "E": unit.E, - "Ei": unit.Ei, -} - -var memorySuffixes = map[string]uint64{ - "Ki": unit.Ki, - "Mi": unit.Mi, - "Gi": unit.Gi, - "Ti": unit.Ti, - "Pi": unit.Pi, - "Ei": unit.Ei, -} - -// CPU shares. One CPUQuantity = 1/1000 of a CPU -type cpuQuantity uint32 - -type gpuQuantity uint64 - -func (u *cpuQuantity) UnmarshalYAML(node *yaml.Node) error { - sval := node.Value - if strings.HasSuffix(sval, "m") { - sval = strings.TrimSuffix(sval, "m") - val, err := strconv.ParseUint(sval, 10, 32) - if err != nil { - return err - } - *u = cpuQuantity(val) - return nil - } - - val, err := strconv.ParseFloat(sval, 64) - if err != nil { - return err - } - - val *= 1000 - - if val < 0 { - return errNegativeValue - } - - *u = cpuQuantity(val) - - return nil -} - -func (u *gpuQuantity) UnmarshalYAML(node *yaml.Node) error { - sval := node.Value - - val, err := strconv.ParseUint(sval, 10, 64) - if err != nil { - return err - } - - *u = gpuQuantity(val) - - return nil -} - -// Memory,Storage size in bytes. -type byteQuantity uint64 -type memoryQuantity uint64 - -func (u *byteQuantity) UnmarshalYAML(node *yaml.Node) error { - val, err := parseWithSuffix(node.Value, unitSuffixes) - if err != nil { - return err - } - *u = byteQuantity(val) - return nil -} - -func (u *memoryQuantity) UnmarshalYAML(node *yaml.Node) error { - val, err := parseWithSuffix(node.Value, memorySuffixes) - if err != nil { - return err - } - *u = memoryQuantity(val) - return nil -} - -func (u *memoryQuantity) StringWithSuffix(suffix string) string { - unit, exists := memorySuffixes[suffix] - - val := uint64(*u) / unit - - res := fmt.Sprintf("%d", val) - if exists { - res += suffix - } - - return res -} - -func parseWithSuffix(sval string, units map[string]uint64) (uint64, error) { - for suffix, unit := range units { - if !strings.HasSuffix(sval, suffix) { - continue - } - - sval := strings.TrimSuffix(sval, suffix) - - val, err := strconv.ParseFloat(sval, 64) - if err != nil { - return 0, err - } - - val *= float64(unit) - - if val < 0 { - return 0, errNegativeValue - } - - return uint64(val), nil - } - - val, err := strconv.ParseFloat(sval, 64) - if err != nil { - return 0, err - } - - if val < 0 { - return 0, errNegativeValue - } - - return uint64(val), nil -} diff --git a/sdl/units_test.go b/sdl/units_test.go deleted file mode 100644 index 559bef3932..0000000000 --- a/sdl/units_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package sdl - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" - - "github.com/akash-network/akash-api/go/node/types/unit" -) - -func TestCPUQuantity(t *testing.T) { - - type vtype struct { - Val cpuQuantity `yaml:"val"` - } - - tests := []struct { - text string - value uint32 - err bool - }{ - {`val: 1`, 1000, false}, - {`val: -1`, 1000, true}, - - {`val: 0.5`, 500, false}, - {`val: -0.5`, 500, true}, - - {`val: "100m"`, 100, false}, - {`val: "-100m"`, 100, true}, - - {`val: ""`, 0, true}, - } - - for idx, test := range tests { - buf := []byte(test.text) - obj := &vtype{} - - err := yaml.Unmarshal(buf, obj) - - if test.err { - assert.Error(t, err, "idx:%v text:`%v`", idx, test.text) - continue - } - - if !assert.NoError(t, err, "idx:%v text:`%v`", idx, test.text) { - continue - } - - assert.Equal(t, cpuQuantity(test.value), obj.Val, "idx:%v text:`%v`", idx, test.text) - } -} - -func TestByteQuantity(t *testing.T) { - type vtype struct { - Val byteQuantity `yaml:"val"` - } - - tests := []struct { - text string - value uint64 - err bool - }{ - {`val: 1`, 1, false}, - {`val: -1`, 1, true}, - - {`val: "1M"`, unit.M, false}, - {`val: "-1M"`, 0, true}, - - {`val: "0.5M"`, unit.M / 2, false}, - {`val: "-0.5M"`, 0, true}, - - {`val: "3M"`, 3 * unit.M, false}, - {`val: "3G"`, 3 * unit.G, false}, - {`val: "3T"`, 3 * unit.T, false}, - {`val: "3P"`, 3 * unit.P, false}, - {`val: "3E"`, 3 * unit.E, false}, - - {`val: ""`, 0, true}, - } - - for idx, test := range tests { - buf := []byte(test.text) - obj := &vtype{} - - err := yaml.Unmarshal(buf, obj) - - if test.err { - assert.Error(t, err, "idx:%v text:`%v`", idx, test.text) - continue - } - - if !assert.NoError(t, err, "idx:%v text:`%v`", idx, test.text) { - continue - } - - assert.Equal(t, byteQuantity(test.value), obj.Val, "idx:%v text:`%v`", idx, test.text) - } -} diff --git a/sdl/util/util.go b/sdl/util/util.go deleted file mode 100644 index 3e80557497..0000000000 --- a/sdl/util/util.go +++ /dev/null @@ -1,31 +0,0 @@ -package util - -import ( - "math" - - sdk "github.com/cosmos/cosmos-sdk/types" - - atypes "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -func ComputeCommittedResources(factor float64, rv atypes.ResourceValue) atypes.ResourceValue { - // If the value is less than 1, commit the original value. There is no concept of undercommit - if factor <= 1.0 { - return rv - } - - v := rv.Val.Uint64() - fraction := 1.0 / factor - committedValue := math.Round(float64(v) * fraction) - - // Don't return a value of zero, since this is used as a resource request - if committedValue <= 0 { - committedValue = 1 - } - - result := atypes.ResourceValue{ - Val: sdk.NewInt(int64(committedValue)), - } - - return result -} diff --git a/sdl/util/util_test.go b/sdl/util/util_test.go deleted file mode 100644 index 3b369399ba..0000000000 --- a/sdl/util/util_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package util_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - atypes "github.com/akash-network/akash-api/go/node/types/v1beta3" - - "github.com/akash-network/node/sdl/util" -) - -func TestComputeCommittedResources(t *testing.T) { - - rv := atypes.NewResourceValue(100) - // Negative factor returns original value - require.Equal(t, uint64(100), util.ComputeCommittedResources(-1.0, rv).Val.Uint64()) - - // Zero factor returns original value - require.Equal(t, uint64(100), util.ComputeCommittedResources(0.0, rv).Val.Uint64()) - - // Factor of one returns the original value - require.Equal(t, uint64(100), util.ComputeCommittedResources(1.0, rv).Val.Uint64()) - - require.Equal(t, uint64(50), util.ComputeCommittedResources(2.0, rv).Val.Uint64()) - - require.Equal(t, uint64(33), util.ComputeCommittedResources(3.0, rv).Val.Uint64()) - - // Even for huge overcommit values, zero is not returned - require.Equal(t, uint64(1), util.ComputeCommittedResources(10000.0, rv).Val.Uint64()) -} diff --git a/sdl/utils.go b/sdl/utils.go deleted file mode 100644 index 6f4ac1c50a..0000000000 --- a/sdl/utils.go +++ /dev/null @@ -1,17 +0,0 @@ -package sdl - -const ( - valueFalse = "false" - valueTrue = "true" -) - -// as per yaml following allowed as bool values -func unifyStringAsBool(val string) (string, bool) { - if val == valueTrue || val == "on" || val == "yes" { - return valueTrue, true - } else if val == valueFalse || val == "off" || val == "no" { - return valueFalse, true - } - - return "", false -} diff --git a/sdl/v2.go b/sdl/v2.go deleted file mode 100644 index d5f8078f72..0000000000 --- a/sdl/v2.go +++ /dev/null @@ -1,582 +0,0 @@ -package sdl - -import ( - "errors" - "fmt" - "path" - "regexp" - "sort" - "strconv" - "strings" - - "gopkg.in/yaml.v3" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -const ( - nextCaseError = "error" - nextCaseTimeout = "timeout" - nextCase500 = "500" - nextCase502 = "502" - nextCase503 = "503" - nextCase504 = "504" - nextCase403 = "403" - nextCase404 = "404" - nextCase400 = "429" - nextCaseOff = "off" - defaultMaxBodySize = uint32(1048576) - upperLimitBodySize = uint32(104857600) - defaultReadTimeout = uint32(60000) - upperLimitReadTimeout = defaultReadTimeout - defaultSendTimeout = uint32(60000) - upperLimitSendTimeout = defaultSendTimeout - defaultNextTries = uint32(3) - endpointKindIP = "ip" -) - -var ( - defaultNextCases = []string{nextCaseError, nextCaseTimeout} - errCannotSpecifyOffAndOtherCases = errors.New("if 'off' is specified, no other cases may be specified") - errUnknownNextCase = errors.New("next case is unknown") - errHTTPOptionNotAllowed = errors.New("http option not allowed") - errSDLInvalid = errors.New("SDL invalid") - errCredentialNoHost = errors.New("Service Credentials missing Host") - errCredentialNoUsername = errors.New("Service Credentials missing Username") - errCredentialNoPassword = errors.New("Service Credentials missing Password") -) - -var endpointNameValidationRegex = regexp.MustCompile(`^[[:lower:]]+[[:lower:]-_\d]+$`) - -var _ SDL = (*v2)(nil) - -type v2 struct { - Include []string `yaml:",omitempty"` - Services map[string]v2Service `yaml:"services,omitempty"` - Profiles v2profiles `yaml:"profiles,omitempty"` - Deployments v2Deployments `yaml:"deployment"` - Endpoints map[string]v2Endpoint `yaml:"endpoints"` - - result struct { - dgroups dtypes.GroupSpecs - mgroups manifest.Groups - } -} - -type v2Deployments map[string]v2Deployment - -type v2Endpoint struct { - Kind string `yaml:"kind"` -} - -type v2ExposeTo struct { - Service string `yaml:"service,omitempty"` - Global bool `yaml:"global,omitempty"` - HTTPOptions v2HTTPOptions `yaml:"http_options"` - IP string `yaml:"ip"` -} - -type v2HTTPOptions struct { - MaxBodySize uint32 `yaml:"max_body_size"` - ReadTimeout uint32 `yaml:"read_timeout"` - SendTimeout uint32 `yaml:"send_timeout"` - NextTries uint32 `yaml:"next_tries"` - NextTimeout uint32 `yaml:"next_timeout"` - NextCases []string `yaml:"next_cases"` -} - -func (ho v2HTTPOptions) asManifest() (manifest.ServiceExposeHTTPOptions, error) { - maxBodySize := ho.MaxBodySize - - if maxBodySize == 0 { - maxBodySize = defaultMaxBodySize - } else if maxBodySize > upperLimitBodySize { - return manifest.ServiceExposeHTTPOptions{}, fmt.Errorf("%w: body size cannot be greater than %d bytes", errHTTPOptionNotAllowed, upperLimitBodySize) - } - - readTimeout := ho.ReadTimeout - if readTimeout == 0 { - readTimeout = defaultReadTimeout - } else if readTimeout > upperLimitReadTimeout { - return manifest.ServiceExposeHTTPOptions{}, fmt.Errorf("%w: read timeout cannot be greater than %d ms", errHTTPOptionNotAllowed, upperLimitReadTimeout) - } - - sendTimeout := ho.SendTimeout - if sendTimeout == 0 { - sendTimeout = defaultSendTimeout - } else if sendTimeout > upperLimitSendTimeout { - return manifest.ServiceExposeHTTPOptions{}, fmt.Errorf("%w: send timeout cannot be greater than %d ms", errHTTPOptionNotAllowed, upperLimitSendTimeout) - } - - nextTries := ho.NextTries - if nextTries == 0 { - nextTries = defaultNextTries - } - - nextCases := ho.NextCases - if len(nextCases) == 0 { - nextCases = defaultNextCases - } else { - for _, nextCase := range nextCases { - switch nextCase { - case nextCaseOff: - if len(nextCases) != 1 { - return manifest.ServiceExposeHTTPOptions{}, errCannotSpecifyOffAndOtherCases - } - case nextCaseError: - case nextCaseTimeout: - case nextCase500: - case nextCase502: - case nextCase503: - case nextCase504: - case nextCase403: - case nextCase404: - case nextCase400: - default: - return manifest.ServiceExposeHTTPOptions{}, fmt.Errorf("%w: %q", errUnknownNextCase, nextCase) - } - } - } - - return manifest.ServiceExposeHTTPOptions{ - MaxBodySize: maxBodySize, - ReadTimeout: readTimeout, - SendTimeout: sendTimeout, - NextTries: nextTries, - NextTimeout: ho.NextTimeout, - NextCases: nextCases, - }, nil -} - -type v2Expose struct { - Port uint32 - As uint32 - Proto string `yaml:"proto,omitempty"` - To []v2ExposeTo `yaml:"to,omitempty"` - Accept v2Accept `yaml:"accept"` - HTTPOptions v2HTTPOptions `yaml:"http_options"` -} - -type v2Exposes []v2Expose - -type v2Dependency struct { - Service string `yaml:"service"` -} - -type v2ServiceParams struct { - Storage map[string]v2ServiceStorageParams `yaml:"storage,omitempty"` -} - -type v2Service struct { - Image string - Command []string `yaml:",omitempty"` - Args []string `yaml:",omitempty"` - Env []string `yaml:",omitempty"` - Expose v2Exposes `yaml:",omitempty"` - Dependencies []v2Dependency `yaml:",omitempty"` - Params *v2ServiceParams `yaml:",omitempty"` - Credentials *v2ServiceCredentials `yaml:",omitempty"` -} - -type v2ServiceCredentials struct { - Host string `yaml:",omitempty"` - Email string `yaml:",omitempty"` - Username string `yaml:",omitempty"` - Password string `yaml:",omitempty"` -} - -func (c v2ServiceCredentials) validate() error { - if strings.TrimSpace(c.Host) == "" { - return errCredentialNoHost - } - if strings.TrimSpace(c.Username) == "" { - return errCredentialNoUsername - } - if strings.TrimSpace(c.Password) == "" { - return errCredentialNoPassword - } - return nil -} - -type v2ServiceDeployment struct { - // Compute profile name - Profile string - - // Number of instances - Count uint32 -} - -// placement-profile -> { compute-profile, count } -type v2Deployment map[string]v2ServiceDeployment - -type v2ProfileCompute struct { - Resources *v2ComputeResources `yaml:"resources,omitempty"` -} - -type v2ProfilePlacement struct { - Attributes v2PlacementAttributes `yaml:"attributes"` - SignedBy types.SignedBy `yaml:"signedBy"` - Pricing v2PlacementPricing `yaml:"pricing"` -} - -type v2profiles struct { - Compute map[string]v2ProfileCompute `yaml:"compute"` - Placement map[string]v2ProfilePlacement `yaml:"placement"` -} - -func (sdl *v2) DeploymentGroups() (dtypes.GroupSpecs, error) { - return sdl.result.dgroups, nil -} - -func (sdl *v2) Manifest() (manifest.Manifest, error) { - return manifest.Manifest(sdl.result.mgroups), nil -} - -// Version creates the deterministic Deployment Version hash from the SDL. -func (sdl *v2) Version() ([]byte, error) { - return manifest.Manifest(sdl.result.mgroups).Version() -} - -func (sdl *v2) UnmarshalYAML(node *yaml.Node) error { - result := v2{} - -loop: - for i := 0; i < len(node.Content); i += 2 { - var val interface{} - switch node.Content[i].Value { - case "include": - val = &result.Include - case "services": - val = &result.Services - case "profiles": - val = &result.Profiles - case "deployment": - val = &result.Deployments - case "endpoints": - val = &result.Endpoints - case sdlVersionField: - // version is already verified - continue loop - default: - return fmt.Errorf("sdl: unexpected field %s", node.Content[i].Value) - } - - if err := node.Content[i+1].Decode(val); err != nil { - return err - } - } - - if err := result.buildGroups(); err != nil { - return err - } - - *sdl = result - - return nil -} - -func (sdl *v2) validate() error { - for endpointName, endpoint := range sdl.Endpoints { - if !endpointNameValidationRegex.MatchString(endpointName) { - return fmt.Errorf( - "%w: endpoint named %q is not a valid name", - errSDLInvalid, - endpointName, - ) - } - - if len(endpoint.Kind) == 0 { - return fmt.Errorf("%w: endpoint named %q has no kind", errSDLInvalid, endpointName) - } - - // Validate endpoint kind, there is only one allowed value for now - if endpoint.Kind != endpointKindIP { - return fmt.Errorf( - "%w: endpoint named %q, unknown kind %q", - errSDLInvalid, - endpointName, - endpoint.Kind, - ) - } - } - - endpointsUsed := make(map[string]struct{}) - portsUsed := make(map[string]string) - for _, svcName := range sdl.Deployments.svcNames() { - depl := sdl.Deployments[svcName] - - for _, placementName := range v2DeploymentPlacementNames(depl) { - svcdepl := depl[placementName] - - compute, ok := sdl.Profiles.Compute[svcdepl.Profile] - if !ok { - return fmt.Errorf( - "%w: %v.%v: no compute profile named %v", - errSDLInvalid, - svcName, - placementName, - svcdepl.Profile, - ) - } - - infra, ok := sdl.Profiles.Placement[placementName] - if !ok { - return fmt.Errorf( - "%w: %v.%v: no placement profile named %v", - errSDLInvalid, - svcName, - placementName, - placementName, - ) - } - - if _, ok := infra.Pricing[svcdepl.Profile]; !ok { - return fmt.Errorf( - "%w: %v.%v: no pricing for profile %v", - errSDLInvalid, - svcName, - placementName, - svcdepl.Profile, - ) - } - - svc, ok := sdl.Services[svcName] - if !ok { - return fmt.Errorf( - "%w: %v.%v: no service profile named %v", - errSDLInvalid, - svcName, - placementName, - svcName, - ) - } - - if svc.Credentials != nil { - if err := svc.Credentials.validate(); err != nil { - return fmt.Errorf( - "%w: %v.%v: %v", - errSDLInvalid, - svcName, - placementName, - err, - ) - } - } - - for _, serviceExpose := range svc.Expose { - for _, to := range serviceExpose.To { - // Check to see if an IP endpoint is also specified - if len(to.IP) != 0 { - if !to.Global { - return fmt.Errorf( - "%w: error on %q if an IP is declared the directive must be declared as global", - errSDLInvalid, - svcName, - ) - } - endpoint, endpointExists := sdl.Endpoints[to.IP] - if !endpointExists { - return fmt.Errorf( - "%w: error on service %q no endpoint named %q exists", - errSDLInvalid, - svcName, - to.IP, - ) - } - - if endpoint.Kind != endpointKindIP { - return fmt.Errorf( - "%w: error on service %q endpoint %q has type %q, should be %q", - errSDLInvalid, - svcName, - to.IP, - endpoint.Kind, - endpointKindIP, - ) - } - - endpointsUsed[to.IP] = struct{}{} - - // Endpoint exists. Now check for port collisions across a single endpoint, port, & protocol - portKey := fmt.Sprintf( - "%s-%d-%s", - to.IP, - serviceExpose.As, - serviceExpose.Proto, - ) - otherServiceName, inUse := portsUsed[portKey] - if inUse { - return fmt.Errorf( - "%w: IP endpoint %q port: %d protocol: %s specified by service %q already in use by %q", - errSDLInvalid, - to.IP, - serviceExpose.Port, - serviceExpose.Proto, - svcName, - otherServiceName, - ) - } - portsUsed[portKey] = svcName - } - } - } - - // validate storage's attributes and parameters - volumes := make(map[string]v2ResourceStorage) - for _, volume := range compute.Resources.Storage { - // making deepcopy here as we gonna merge compute attributes and service parameters for validation below - attr := make(v2StorageAttributes, len(volume.Attributes)) - - copy(attr, volume.Attributes) - - volumes[volume.Name] = v2ResourceStorage{ - Name: volume.Name, - Quantity: volume.Quantity, - Attributes: attr, - } - } - - attr := make(map[string]string) - mounts := make(map[string]string) - - if svc.Params != nil { - for name, params := range svc.Params.Storage { - if _, exists := volumes[name]; !exists { - return fmt.Errorf( - "%w: service \"%s\" references to no-existing compute volume named \"%s\"", - errSDLInvalid, - svcName, - name, - ) - } - - if !path.IsAbs(params.Mount) { - return fmt.Errorf( - "%w: invalid value for \"service.%s.params.%s.mount\" parameter. expected absolute path", - errSDLInvalid, - svcName, - name, - ) - } - - attr[StorageAttributeMount] = params.Mount - attr[StorageAttributeReadOnly] = strconv.FormatBool(params.ReadOnly) - - mount := attr[StorageAttributeMount] - if vlname, exists := mounts[mount]; exists { - if mount == "" { - return errStorageMultipleRootEphemeral - } - - return fmt.Errorf( - "%w: mount %q already in use by volume %q", - errStorageDupMountPoint, - mount, - vlname, - ) - } - - mounts[mount] = name - } - } - - for name, volume := range volumes { - for _, nd := range types.Attributes(volume.Attributes) { - attr[nd.Key] = nd.Value - } - - persistent, _ := strconv.ParseBool(attr[StorageAttributePersistent]) - - if persistent && attr[StorageAttributeMount] == "" { - return fmt.Errorf( - "%w: compute.storage.%s has persistent=true which requires service.%s.params.storage.%s to have mount", - errSDLInvalid, - name, - svcName, - name, - ) - } - } - } - } - - for endpointName := range sdl.Endpoints { - _, inUse := endpointsUsed[endpointName] - if !inUse { - return fmt.Errorf( - "%w: endpoint %q declared but never used", - errSDLInvalid, - endpointName, - ) - } - } - - return nil -} - -func (sdl *v2) computeEndpointSequenceNumbers() map[string]uint32 { - var endpointNames []string - res := make(map[string]uint32) - - for _, serviceName := range sdl.Deployments.svcNames() { - for _, expose := range sdl.Services[serviceName].Expose { - for _, to := range expose.To { - if to.Global && len(to.IP) == 0 { - continue - } - - endpointNames = append(endpointNames, to.IP) - } - } - } - - if len(endpointNames) == 0 { - return res - } - - // Make the assignment stable - sort.Strings(endpointNames) - - // Start at zero, so the first assigned one is 1 - endpointSeqNumber := uint32(0) - for _, name := range endpointNames { - endpointSeqNumber++ - seqNo := endpointSeqNumber - res[name] = seqNo - } - - return res -} - -func (sdl v2Deployments) svcNames() []string { - names := make([]string, 0, len(sdl)) - for name := range sdl { - names = append(names, name) - } - sort.Strings(names) - - return names -} - -// placementNames stable ordered placement names -func (sdl v2Deployment) placementNames() []string { - names := make([]string, 0, len(sdl)) - for name := range sdl { - names = append(names, name) - } - sort.Strings(names) - - return names -} - -func v2DeploymentPlacementNames(m v2Deployment) []string { - names := make([]string, 0, len(m)) - for name := range m { - names = append(names, name) - } - sort.Strings(names) - - return names -} diff --git a/sdl/v2_1.go b/sdl/v2_1.go deleted file mode 100644 index 98fcdec844..0000000000 --- a/sdl/v2_1.go +++ /dev/null @@ -1,364 +0,0 @@ -package sdl - -import ( - "fmt" - "path" - "sort" - "strconv" - - "gopkg.in/yaml.v3" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -var _ SDL = (*v2_1)(nil) - -type v2_1 struct { - Include []string `yaml:",omitempty"` - Services map[string]v2Service `yaml:"services,omitempty"` - Profiles v2profiles `yaml:"profiles,omitempty"` - Deployments v2Deployments `yaml:"deployment"` - Endpoints map[string]v2Endpoint `yaml:"endpoints"` - - result struct { - dgroups dtypes.GroupSpecs - mgroups manifest.Groups - } -} - -func (sdl *v2_1) DeploymentGroups() (dtypes.GroupSpecs, error) { - return sdl.result.dgroups, nil -} - -func (sdl *v2_1) Manifest() (manifest.Manifest, error) { - return manifest.Manifest(sdl.result.mgroups), nil -} - -// Version creates the deterministic Deployment Version hash from the SDL. -func (sdl *v2_1) Version() ([]byte, error) { - return manifest.Manifest(sdl.result.mgroups).Version() -} - -func (sdl *v2_1) UnmarshalYAML(node *yaml.Node) error { - result := v2_1{} - -loop: - for i := 0; i < len(node.Content); i += 2 { - var val interface{} - switch node.Content[i].Value { - case "include": - val = &result.Include - case "services": - val = &result.Services - case "profiles": - val = &result.Profiles - case "deployment": - val = &result.Deployments - case "endpoints": - val = &result.Endpoints - case sdlVersionField: - // version is already verified - continue loop - default: - return fmt.Errorf("sdl: unexpected field %s", node.Content[i].Value) - } - - if err := node.Content[i+1].Decode(val); err != nil { - return err - } - } - - if err := result.buildGroups(); err != nil { - return err - } - - *sdl = result - - return nil -} - -func (sdl *v2_1) validate() error { - for endpointName, endpoint := range sdl.Endpoints { - if !endpointNameValidationRegex.MatchString(endpointName) { - return fmt.Errorf( - "%w: endpoint named %q is not a valid name", - errSDLInvalid, - endpointName, - ) - } - - if len(endpoint.Kind) == 0 { - return fmt.Errorf("%w: endpoint named %q has no kind", errSDLInvalid, endpointName) - } - - // Validate endpoint kind, there is only one allowed value for now - if endpoint.Kind != endpointKindIP { - return fmt.Errorf( - "%w: endpoint named %q, unknown kind %q", - errSDLInvalid, - endpointName, - endpoint.Kind, - ) - } - } - - endpointsUsed := make(map[string]struct{}) - portsUsed := make(map[string]string) - for _, svcName := range sdl.Deployments.svcNames() { - depl := sdl.Deployments[svcName] - - for _, placementName := range v2DeploymentPlacementNames(depl) { - svcdepl := depl[placementName] - - compute, ok := sdl.Profiles.Compute[svcdepl.Profile] - if !ok { - return fmt.Errorf( - "%w: %v.%v: no compute profile named %v", - errSDLInvalid, - svcName, - placementName, - svcdepl.Profile, - ) - } - - infra, ok := sdl.Profiles.Placement[placementName] - if !ok { - return fmt.Errorf( - "%w: %v.%v: no placement profile named %v", - errSDLInvalid, - svcName, - placementName, - placementName, - ) - } - - if _, ok := infra.Pricing[svcdepl.Profile]; !ok { - return fmt.Errorf( - "%w: %v.%v: no pricing for profile %v", - errSDLInvalid, - svcName, - placementName, - svcdepl.Profile, - ) - } - - svc, ok := sdl.Services[svcName] - if !ok { - return fmt.Errorf( - "%w: %v.%v: no service profile named %v", - errSDLInvalid, - svcName, - placementName, - svcName, - ) - } - - if svc.Credentials != nil { - if err := svc.Credentials.validate(); err != nil { - return fmt.Errorf( - "%w: %v.%v: %v", - errSDLInvalid, - svcName, - placementName, - err, - ) - } - } - - for _, serviceExpose := range svc.Expose { - for _, to := range serviceExpose.To { - // Check to see if an IP endpoint is also specified - if len(to.IP) != 0 { - if !to.Global { - return fmt.Errorf( - "%w: error on %q if an IP is declared the directive must be declared as global", - errSDLInvalid, - svcName, - ) - } - endpoint, endpointExists := sdl.Endpoints[to.IP] - if !endpointExists { - return fmt.Errorf( - "%w: error on service %q no endpoint named %q exists", - errSDLInvalid, - svcName, - to.IP, - ) - } - - if endpoint.Kind != endpointKindIP { - return fmt.Errorf( - "%w: error on service %q endpoint %q has type %q, should be %q", - errSDLInvalid, - svcName, - to.IP, - endpoint.Kind, - endpointKindIP, - ) - } - - endpointsUsed[to.IP] = struct{}{} - - // Endpoint exists. Now check for port collisions across a single endpoint, port, & protocol - portKey := fmt.Sprintf( - "%s-%d-%s", - to.IP, - serviceExpose.As, - serviceExpose.Proto, - ) - otherServiceName, inUse := portsUsed[portKey] - if inUse { - return fmt.Errorf( - "%w: IP endpoint %q port: %d protocol: %s specified by service %q already in use by %q", - errSDLInvalid, - to.IP, - serviceExpose.Port, - serviceExpose.Proto, - svcName, - otherServiceName, - ) - } - portsUsed[portKey] = svcName - } - } - } - - // validate storage's attributes and parameters - volumes := make(map[string]v2ResourceStorage) - for _, volume := range compute.Resources.Storage { - // making deepcopy here as we gonna merge compute attributes and service parameters for validation below - attr := make(v2StorageAttributes, len(volume.Attributes)) - - copy(attr, volume.Attributes) - - volumes[volume.Name] = v2ResourceStorage{ - Name: volume.Name, - Quantity: volume.Quantity, - Attributes: attr, - } - } - - if svc.Params != nil { - mounts := make(map[string]string) - - for name, params := range svc.Params.Storage { - - volume, exists := volumes[name] - - if !exists { - return fmt.Errorf( - "%w: service \"%s\" references to no-existing compute volume named \"%s\"", - errSDLInvalid, - svcName, - name, - ) - } - - if !path.IsAbs(params.Mount) { - return fmt.Errorf( - "%w: invalid value for \"service.%s.params.%s.mount\" parameter. expected absolute path", - errSDLInvalid, - svcName, - name, - ) - } - - if vlname, exists := mounts[params.Mount]; exists { - if params.Mount == "" { - return errStorageMultipleRootEphemeral - } - - return fmt.Errorf( - "%w: mount %q already in use by volume %q", - errStorageDupMountPoint, - params.Mount, - vlname, - ) - } - - mounts[params.Mount] = name - - attr := make(map[string]string) - attr[StorageAttributeMount] = params.Mount - attr[StorageAttributeReadOnly] = strconv.FormatBool(params.ReadOnly) - - for _, nd := range types.Attributes(volume.Attributes) { - attr[nd.Key] = nd.Value - } - - persistent, _ := strconv.ParseBool(attr[StorageAttributePersistent]) - class := attr[StorageAttributeClass] - - if persistent && params.Mount == "" { - return fmt.Errorf( - "%w: compute.storage.%s has persistent=true which requires service.%s.params.storage.%s to have mount", - errSDLInvalid, - name, - svcName, - name, - ) - } - - if class == StorageClassRAM && params.ReadOnly { - return fmt.Errorf( - "%w: services.%s.params.storage.%s has readOnly=true which is not allowed for storage class \"%s\"", - errSDLInvalid, - svcName, - name, - class, - ) - } - } - } - } - } - - for endpointName := range sdl.Endpoints { - _, inUse := endpointsUsed[endpointName] - if !inUse { - return fmt.Errorf( - "%w: endpoint %q declared but never used", - errSDLInvalid, - endpointName, - ) - } - } - - return nil -} - -func (sdl *v2_1) computeEndpointSequenceNumbers() map[string]uint32 { - var endpointNames []string - res := make(map[string]uint32) - - for _, serviceName := range sdl.Deployments.svcNames() { - for _, expose := range sdl.Services[serviceName].Expose { - for _, to := range expose.To { - if to.Global && len(to.IP) == 0 { - continue - } - - endpointNames = append(endpointNames, to.IP) - } - } - } - - if len(endpointNames) == 0 { - return res - } - - // Make the assignment stable - sort.Strings(endpointNames) - - // Start at zero, so the first assigned one is 1 - endpointSeqNumber := uint32(0) - for _, name := range endpointNames { - endpointSeqNumber++ - seqNo := endpointSeqNumber - res[name] = seqNo - } - - return res -} diff --git a/sdl/v2_1_ip_test.go b/sdl/v2_1_ip_test.go deleted file mode 100644 index 645719cfd9..0000000000 --- a/sdl/v2_1_ip_test.go +++ /dev/null @@ -1,279 +0,0 @@ -package sdl - -import ( - "bytes" - "fmt" - "testing" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - "github.com/stretchr/testify/require" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -func TestV2_1_ParseSimpleWithIP(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-simple-with-ip.yaml") - require.NoError(t, err) - require.NotNil(t, sdl) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 1) - group := groups[0] - resources := group.GetResourceUnits() - require.Len(t, resources, 1) - resource := resources[0] - - ipEndpoint := findIPEndpoint(t, resource.Resources.Endpoints, 1) - - require.Equal(t, ipEndpoint.Kind, types.Endpoint_LEASED_IP) - - mani, err := sdl.Manifest() - require.NoError(t, err) - var exposeIP manifest.ServiceExpose - for _, expose := range mani[0].Services[0].Expose { - if len(expose.IP) != 0 { - exposeIP = expose - break - } - } - require.NotEmpty(t, exposeIP.IP) - require.Equal(t, exposeIP.Proto, manifest.UDP) - require.Equal(t, exposeIP.Port, uint32(12345)) - require.True(t, exposeIP.Global) -} - -func TestV2_1_Parse_IP(t *testing.T) { - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2.1-ip-endpoint.yaml") - require.NoError(t, err) - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - - require.Len(t, groups, 1) - group := groups[0] - - resources := group.GetResourceUnits() - require.Len(t, resources, 1) - resource := resources[0] - endpoints := resource.Resources.Endpoints - require.Len(t, endpoints, 2) - - var ipEndpoint types.Endpoint - for _, endpoint := range endpoints { - if endpoint.Kind == types.Endpoint_LEASED_IP { - ipEndpoint = endpoint - } - } - - require.Equal(t, ipEndpoint.Kind, types.Endpoint_LEASED_IP) - require.Greater(t, ipEndpoint.SequenceNumber, uint32(0)) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - maniGroups := mani.GetGroups() - require.Len(t, maniGroups, 1) - maniGroup := maniGroups[0] - services := maniGroup.Services - require.Len(t, services, 1) - - service := services[0] - exposes := service.Expose - require.Len(t, exposes, 1) - - expose := exposes[0] - - require.True(t, expose.Global) - require.Equal(t, expose.IP, "meow") - require.Greater(t, expose.EndpointSequenceNumber, uint32(0)) -} - -func TestV2_1_Parse_SharedIP(t *testing.T) { - // Read a file with 1 group having 1 endpoint shared amongst containers - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2.1-shared-ip-endpoint.yaml") - require.NoError(t, err) - - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 1) - - group := groups[0] - - resources := group.GetResourceUnits() - require.Len(t, resources, 1) - - resource := resources[0] - ipEndpoint1 := findIPEndpoint(t, resource.Resources.Endpoints, 1) - require.Greater(t, ipEndpoint1.SequenceNumber, uint32(0)) - - ipEndpoint2 := findIPEndpoint(t, resource.Resources.Endpoints, 2) - require.Greater(t, ipEndpoint2.SequenceNumber, uint32(0)) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - - maniGroups := mani.GetGroups() - require.Len(t, maniGroups, 1) - maniGroup := maniGroups[0] - - services := maniGroup.Services - require.Len(t, services, 2) - serviceA := services[0] - - serviceIPEndpoint := findIPEndpoint(t, serviceA.Resources.Endpoints, 1) - require.Equal(t, serviceIPEndpoint.SequenceNumber, ipEndpoint1.SequenceNumber) - - serviceB := services[1] - serviceIPEndpoint = findIPEndpoint(t, serviceB.Resources.Endpoints, 1) - require.Equal(t, serviceIPEndpoint.SequenceNumber, ipEndpoint2.SequenceNumber) -} - -func TestV2_1_Parse_MultipleIP(t *testing.T) { - // Read a file with 1 group having two endpoints - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2.1-multi-ip-endpoint.yaml") - require.NoError(t, err) - - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 1) - - group := groups[0] - - resources := group.GetResourceUnits() - require.Len(t, resources, 1) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - _ = mani -} - -func TestV2_1_Parse_MultipleGroupsIP(t *testing.T) { - // Read a file with two groups, each one having an IP endpoint that is distinct - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2.1-multi-groups-ip-endpoint.yaml") - require.NoError(t, err) - - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 2) - - resources := groups[0].GetResourceUnits() - require.Len(t, resources, 1) - - resource := resources[0] - require.Len(t, resource.Resources.Endpoints, 2) - ipEndpointFirstGroup := findIPEndpoint(t, resource.Resources.Endpoints, 1) - require.Greater(t, ipEndpointFirstGroup.SequenceNumber, uint32(0)) - - resources = groups[1].GetResourceUnits() - require.Len(t, resources, 1) - - resource = resources[0] - require.Len(t, resource.Resources.Endpoints, 2) - ipEndpointSecondGroup := findIPEndpoint(t, resource.Resources.Endpoints, 1) - require.Greater(t, ipEndpointSecondGroup.SequenceNumber, uint32(0)) - require.NotEqual(t, ipEndpointFirstGroup.SequenceNumber, ipEndpointSecondGroup.SequenceNumber) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - maniGroups := mani.GetGroups() - require.Len(t, maniGroups, 2) - - maniGroup := maniGroups[0] - mresources := maniGroup.GetResourceUnits() - require.Len(t, mresources, 1) - mresource := mresources[0] - require.Equal(t, findIPEndpoint(t, mresource.Endpoints, 1).SequenceNumber, ipEndpointFirstGroup.SequenceNumber) - - maniGroup = maniGroups[1] - mresources = maniGroup.GetResourceUnits() - require.Len(t, mresources, 1) - mresource = mresources[0] - require.Equal(t, findIPEndpoint(t, mresource.Endpoints, 1).SequenceNumber, ipEndpointSecondGroup.SequenceNumber) - -} - -func TestV2_1_Parse_IPEndpointNaming(t *testing.T) { - makeSDLWithEndpointName := func(name string) []byte { - const originalSDL = `--- -version: "2.1" - -services: - web: - image: ghcr.io/akash-network/demo-app - expose: - - port: 80 - to: - - global: true - ip: %q - accept: - - test.localhost - -profiles: - compute: - web: - resources: - cpu: - units: "0.01" - memory: - size: "128Mi" - storage: - size: "512Mi" - - placement: - global: - pricing: - web: - denom: uakt - amount: 10 - -deployment: - web: - global: - profile: web - count: 1 - -endpoints: - %q: - kind: ip -` - buf := &bytes.Buffer{} - _, err := fmt.Fprintf(buf, originalSDL, name, name) - require.NoError(t, err) - return buf.Bytes() - } - - _, err := Read(makeSDLWithEndpointName("meow72-memes")) - require.NoError(t, err) - - _, err = Read(makeSDLWithEndpointName("meow72-mem_es")) - require.NoError(t, err) - - _, err = Read(makeSDLWithEndpointName("!important")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("foo^bar")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("ROAR")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("996")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("_kittens")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("-kittens")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") -} diff --git a/sdl/v2_1_test.go b/sdl/v2_1_test.go deleted file mode 100644 index 6e67f0d05e..0000000000 --- a/sdl/v2_1_test.go +++ /dev/null @@ -1,760 +0,0 @@ -package sdl - -import ( - "testing" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/akash-api/go/node/types/unit" - atypes "github.com/akash-network/akash-api/go/node/types/v1beta3" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - // "github.com/akash-network/node/testutil" -) - -func TestV2_1_ParseSimpleGPU(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-simple-gpu.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 1) - assert.Len(t, group.Requirements.Attributes, 2) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[1]) - - assert.Len(t, group.GetResourceUnits(), 1) - - assert.Equal(t, dtypes.ResourceUnit{ - Count: 2, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(randGPU), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/a100", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, group.GetResourceUnits()[0]) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - expectedHosts := make([]string, 1) - expectedHosts[0] = "ahostname.com" // nolint: goconst - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "web", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/a100", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 2, - Expose: []manifest.ServiceExpose{ - {Port: 80, Global: true, Proto: manifest.TCP, Hosts: expectedHosts, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - {Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - }, - }, - }, - }, mani.GetGroups()[0]) -} - -func TestV2_1_Parse_Deployments(t *testing.T) { - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2.1.yaml") - require.NoError(t, err) - _, err = sdl1.DeploymentGroups() - require.NoError(t, err) - - _, err = sdl1.Manifest() - require.NoError(t, err) - - sha1, err := sdl1.Version() - require.NoError(t, err) - assert.Len(t, sha1, 32) - - sdl2, err := ReadFile("../x/deployment/testdata/deployment-v2.yaml") - require.NoError(t, err) - sha2, err := sdl2.Version() - - require.NoError(t, err) - assert.Len(t, sha2, 32) - require.NotEqual(t, sha1, sha2) -} - -func Test_V2_1_Cross_Validates(t *testing.T) { - sdl2, err := ReadFile("../x/deployment/testdata/deployment-v2.yaml") - require.NoError(t, err) - dgroups, err := sdl2.DeploymentGroups() - require.NoError(t, err) - m, err := sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other. If this test fails at least one of the - // following is ture - // 1. Cross validation logic is wrong - // 2. The DeploymentGroups() & Manifest() code do not agree with one another - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - - // Repeat the same test with another file - sdl2, err = ReadFile("./_testdata/v2.1-simple.yaml") - require.NoError(t, err) - dgroups, err = sdl2.DeploymentGroups() - require.NoError(t, err) - m, err = sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - - // Repeat the same test with another file - sdl2, err = ReadFile("./_testdata/v2.1-simple3.yaml") - require.NoError(t, err) - dgroups, err = sdl2.DeploymentGroups() - require.NoError(t, err) - m, err = sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - - // Repeat the same test with another file - sdl2, err = ReadFile("./_testdata/v2.1-private_service.yaml") - require.NoError(t, err) - dgroups, err = sdl2.DeploymentGroups() - require.NoError(t, err) - m, err = sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - -} - -func Test_V2_1_Parse_simple(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-simple.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 1) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[0]) - - assert.Len(t, group.GetResourceUnits(), 1) - - assert.Equal(t, dtypes.ResourceUnit{ - Count: 2, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, group.GetResourceUnits()[0]) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - expectedHosts := make([]string, 1) - expectedHosts[0] = "ahostname.com" - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "web", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 2, - Expose: []manifest.ServiceExpose{ - {Port: 80, Global: true, Proto: manifest.TCP, Hosts: expectedHosts, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - {Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - }, - }, - }, - }, mani.GetGroups()[0]) - - assert.Nil(t, mani.GetGroups()[0].Services[0].Credentials) - -} - -func Test_V2_1_Parse_credentials(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-credentials.yaml") - require.NoError(t, err) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - grp := mani.GetGroups()[0] - assert.Len(t, grp.Services, 1) - - svc := grp.Services[0] - - assert.NotNil(t, svc) - - creds := svc.Credentials - assert.NotNil(t, creds) - - assert.Equal(t, "https://test.com/v1", creds.Host) - assert.Equal(t, "foo", creds.Username) - assert.Equal(t, "foo", creds.Password) -} - -func Test_V2_1_Parse_credentials_error(t *testing.T) { - _, err := ReadFile("./_testdata/v2.1-credentials-error.yaml") - require.Error(t, err) -} - -func Test_v2_1_Parse_ProfileNameNotServiceName(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-profile-svc-name-mismatch.yaml") - require.NoError(t, err) - - dgroups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, dgroups, 1) - - mani, err := sdl.Manifest() - require.NoError(t, err) - assert.Len(t, mani.GetGroups(), 1) -} - -func Test_v2_1_Parse_DeploymentNameServiceNameMismatch(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-deployment-svc-mismatch.yaml") - require.Error(t, err) - require.Nil(t, sdl) - require.Contains(t, err.Error(), "no service profile named") - - sdl, err = ReadFile("./_testdata/v2.1-simple2.yaml") - require.NoError(t, err) - require.NotNil(t, sdl) - - dgroups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, dgroups, 1) - - mani, err := sdl.Manifest() - require.NoError(t, err) - assert.Len(t, mani.GetGroups(), 1) - - require.Equal(t, dgroups[0].Name, mani.GetGroups()[0].Name) - // SDL lists 2 services, but particular deployment specifies only one - require.Len(t, mani.GetGroups()[0].Services, 1) - - // make sure deployment maps to the right service - require.Len(t, mani.GetGroups()[0].Services[0].Expose, 2) - require.Len(t, mani.GetGroups()[0].Services[0].Expose[0].Hosts, 1) - require.Equal(t, mani.GetGroups()[0].Services[0].Expose[0].Hosts[0], "ahostname.com") -} - -func TestV2_1_ParseServiceMix(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-service-mix.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 2) - assert.Len(t, group.Requirements.Attributes, 2) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[1]) - - assert.Equal(t, dtypes.ResourceUnits{ - { - Count: 1, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(randGPU), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - { - Count: 1, - Resources: atypes.Resources{ - ID: 2, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - }, group.GetResourceUnits()) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "svca", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"ahostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - { - Name: "svcb", - Image: "nginx", - Resources: atypes.Resources{ - ID: 2, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"bhostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12346, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - }, - }, mani.GetGroups()[0]) -} - -func TestV2_1_ParseServiceMix2(t *testing.T) { - sdl, err := ReadFile("./_testdata/v2.1-service-mix2.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 1) - assert.Len(t, group.Requirements.Attributes, 2) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[1]) - - assert.Equal(t, dtypes.ResourceUnits{ - { - Count: 2, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(randGPU), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - }, group.GetResourceUnits()) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "svca", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"ahostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - { - Name: "svcb", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"bhostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12346, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - }, - }, mani.GetGroups()[0]) -} diff --git a/sdl/v2_ip_test.go b/sdl/v2_ip_test.go deleted file mode 100644 index 090f525107..0000000000 --- a/sdl/v2_ip_test.go +++ /dev/null @@ -1,297 +0,0 @@ -package sdl - -import ( - "bytes" - "fmt" - "testing" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - "github.com/stretchr/testify/require" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" -) - -func findIPEndpoint(t *testing.T, endpoints []types.Endpoint, id int) types.Endpoint { - t.Helper() - - idx := 0 - for _, endpoint := range endpoints { - if endpoint.Kind == types.Endpoint_LEASED_IP { - idx++ - if id == idx { - return endpoint - } - } - } - - t.Fatal("did not find any IP endpoints") - return types.Endpoint{} -} - -func TestV2ParseSimpleWithIP(t *testing.T) { - sdl, err := ReadFile("./_testdata/simple-with-ip.yaml") - require.NoError(t, err) - require.NotNil(t, sdl) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 1) - group := groups[0] - resources := group.GetResourceUnits() - require.Len(t, resources, 1) - resource := resources[0] - - ipEndpoint := findIPEndpoint(t, resource.Resources.Endpoints, 1) - - require.Equal(t, ipEndpoint.Kind, types.Endpoint_LEASED_IP) - - mani, err := sdl.Manifest() - require.NoError(t, err) - var exposeIP manifest.ServiceExpose - for _, expose := range mani[0].Services[0].Expose { - if len(expose.IP) != 0 { - exposeIP = expose - break - } - } - require.NotEmpty(t, exposeIP.IP) - require.Equal(t, exposeIP.Proto, manifest.UDP) - require.Equal(t, exposeIP.Port, uint32(12345)) - require.True(t, exposeIP.Global) -} - -func TestV2Parse_IP(t *testing.T) { - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2-ip-endpoint.yaml") - require.NoError(t, err) - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - - require.Len(t, groups, 1) - group := groups[0] - - resources := group.GetResourceUnits() - require.Len(t, resources, 1) - resource := resources[0] - endpoints := resource.Resources.Endpoints - require.Len(t, endpoints, 2) - - var ipEndpoint types.Endpoint - for _, endpoint := range endpoints { - if endpoint.Kind == types.Endpoint_LEASED_IP { - ipEndpoint = endpoint - } - } - - require.Equal(t, ipEndpoint.Kind, types.Endpoint_LEASED_IP) - require.Greater(t, ipEndpoint.SequenceNumber, uint32(0)) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - maniGroups := mani.GetGroups() - require.Len(t, maniGroups, 1) - maniGroup := maniGroups[0] - services := maniGroup.Services - require.Len(t, services, 1) - - service := services[0] - exposes := service.Expose - require.Len(t, exposes, 1) - - expose := exposes[0] - - require.True(t, expose.Global) - require.Equal(t, expose.IP, "meow") - require.Greater(t, expose.EndpointSequenceNumber, uint32(0)) -} - -func TestV2Parse_SharedIP(t *testing.T) { - // Read a file with 1 group having 1 endpoint shared amongst containers - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2-shared-ip-endpoint.yaml") - require.NoError(t, err) - - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 1) - - group := groups[0] - - resources := group.GetResourceUnits() - require.Len(t, resources, 2) - - // resource := resources[0] - ipEndpoint1 := findIPEndpoint(t, resources[0].Resources.Endpoints, 1) - require.Greater(t, ipEndpoint1.SequenceNumber, uint32(0)) - - ipEndpoint2 := findIPEndpoint(t, resources[1].Resources.Endpoints, 1) - require.Greater(t, ipEndpoint2.SequenceNumber, uint32(0)) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - - maniGroups := mani.GetGroups() - require.Len(t, maniGroups, 1) - maniGroup := maniGroups[0] - - services := maniGroup.Services - require.Len(t, services, 2) - serviceA := services[0] - - serviceIPEndpoint := findIPEndpoint(t, serviceA.Resources.Endpoints, 1) - require.Equal(t, serviceIPEndpoint.SequenceNumber, ipEndpoint1.SequenceNumber) - - serviceB := services[1] - serviceIPEndpoint = findIPEndpoint(t, serviceB.Resources.Endpoints, 1) - require.Equal(t, serviceIPEndpoint.SequenceNumber, ipEndpoint2.SequenceNumber) -} - -func TestV2Parse_MultipleIP(t *testing.T) { - // Read a file with 1 group having two endpoints - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2-multi-ip-endpoint.yaml") - require.NoError(t, err) - - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 1) - - group := groups[0] - - resources := group.GetResourceUnits() - require.Len(t, resources, 2) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - _ = mani -} - -func TestV2Parse_MultipleGroupsIP(t *testing.T) { - // Read a file with two groups, each one having an IP endpoint that is distinct - sdl1, err := ReadFile("../x/deployment/testdata/deployment-v2-multi-groups-ip-endpoint.yaml") - require.NoError(t, err) - - groups, err := sdl1.DeploymentGroups() - require.NoError(t, err) - require.Len(t, groups, 2) - - resources := groups[0].GetResourceUnits() - require.Len(t, resources, 1) - - resource := resources[0] - require.Len(t, resource.Resources.Endpoints, 2) - ipEndpointFirstGroup := findIPEndpoint(t, resource.Resources.Endpoints, 1) - require.Greater(t, ipEndpointFirstGroup.SequenceNumber, uint32(0)) - - resources = groups[1].GetResourceUnits() - require.Len(t, resources, 1) - - resource = resources[0] - require.Len(t, resource.Resources.Endpoints, 2) - ipEndpointSecondGroup := findIPEndpoint(t, resource.Resources.Endpoints, 1) - require.Greater(t, ipEndpointSecondGroup.SequenceNumber, uint32(0)) - require.NotEqual(t, ipEndpointFirstGroup.SequenceNumber, ipEndpointSecondGroup.SequenceNumber) - - mani, err := sdl1.Manifest() - require.NoError(t, err) - maniGroups := mani.GetGroups() - require.Len(t, maniGroups, 2) - - maniGroup := maniGroups[0] - mresources := maniGroup.GetResourceUnits() - require.Len(t, mresources, 1) - mresource := mresources[0] - require.Equal(t, findIPEndpoint(t, mresource.Endpoints, 1).SequenceNumber, ipEndpointFirstGroup.SequenceNumber) - - maniGroup = maniGroups[1] - mresources = maniGroup.GetResourceUnits() - require.Len(t, mresources, 1) - mresource = mresources[0] - require.Equal(t, findIPEndpoint(t, mresource.Endpoints, 1).SequenceNumber, ipEndpointSecondGroup.SequenceNumber) - -} - -func TestV2Parse_IPEndpointNaming(t *testing.T) { - makeSDLWithEndpointName := func(name string) []byte { - const originalSDL = `--- -version: "2.0" - -services: - web: - image: ghcr.io/akash-network/demo-app - expose: - - port: 80 - to: - - global: true - ip: %q - accept: - - test.localhost - -profiles: - compute: - web: - resources: - cpu: - units: "0.01" - memory: - size: "128Mi" - storage: - size: "512Mi" - - placement: - global: - pricing: - web: - denom: uakt - amount: 10 - -deployment: - web: - global: - profile: web - count: 1 - -endpoints: - %q: - kind: ip -` - buf := &bytes.Buffer{} - _, err := fmt.Fprintf(buf, originalSDL, name, name) - require.NoError(t, err) - return buf.Bytes() - } - - _, err := Read(makeSDLWithEndpointName("meow72-memes")) - require.NoError(t, err) - - _, err = Read(makeSDLWithEndpointName("meow72-mem_es")) - require.NoError(t, err) - - _, err = Read(makeSDLWithEndpointName("!important")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("foo^bar")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("ROAR")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("996")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("_kittens")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - - _, err = Read(makeSDLWithEndpointName("-kittens")) - require.Error(t, err) - require.ErrorIs(t, err, errSDLInvalid) - require.Contains(t, err.Error(), "not a valid name") - -} diff --git a/sdl/v2_test.go b/sdl/v2_test.go deleted file mode 100644 index 859d621f4e..0000000000 --- a/sdl/v2_test.go +++ /dev/null @@ -1,940 +0,0 @@ -package sdl - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" - - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/akash-api/go/node/types/unit" - atypes "github.com/akash-network/akash-api/go/node/types/v1beta3" - // "github.com/akash-network/node/testutil" -) - -func TestV2Expose(t *testing.T) { - var stream = ` -- port: 80 - as: 80 - accept: - - hello.localhost - to: - - global: true -` - - var p []v2Expose - - err := yaml.Unmarshal([]byte(stream), &p) - require.NoError(t, err) -} - -func AkashDecCoin(t testing.TB, amount int64) sdk.DecCoin { - t.Helper() - amt := sdk.NewInt(amount) - return sdk.NewDecCoin("uakt", amt) -} - -const ( - randCPU uint64 = 100 - randGPU uint64 = 1 - randMemory uint64 = 128 * unit.Mi - randStorage uint64 = 1 * unit.Gi -) - -var ( - defaultHTTPOptions = manifest.ServiceExposeHTTPOptions{ - MaxBodySize: defaultMaxBodySize, - ReadTimeout: defaultReadTimeout, - SendTimeout: defaultSendTimeout, - NextTries: defaultNextTries, - NextCases: []string{"error", "timeout"}, - } -) - -func TestV2ParseSimpleGPU(t *testing.T) { - sdl, err := ReadFile("./_testdata/simple-gpu.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 1) - assert.Len(t, group.Requirements.Attributes, 2) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[1]) - - assert.Len(t, group.GetResourceUnits(), 1) - - assert.Equal(t, dtypes.ResourceUnit{ - Count: 2, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(randGPU), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/a100", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, group.GetResourceUnits()[0]) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - expectedHosts := make([]string, 1) - expectedHosts[0] = "ahostname.com" - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "web", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/a100", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 2, - Expose: []manifest.ServiceExpose{ - {Port: 80, Global: true, Proto: manifest.TCP, Hosts: expectedHosts, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - {Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - }, - }, - }, - }, mani.GetGroups()[0]) -} - -func TestV2Parse_Deployments(t *testing.T) { - sdl1, err := ReadFile("../x/deployment/testdata/deployment.yaml") - require.NoError(t, err) - _, err = sdl1.DeploymentGroups() - require.NoError(t, err) - - _, err = sdl1.Manifest() - require.NoError(t, err) - - sha1, err := sdl1.Version() - require.NoError(t, err) - assert.Len(t, sha1, 32) - - sdl2, err := ReadFile("../x/deployment/testdata/deployment-v2.yaml") - require.NoError(t, err) - sha2, err := sdl2.Version() - - require.NoError(t, err) - assert.Len(t, sha2, 32) - require.NotEqual(t, sha1, sha2) -} - -func Test_V2_Cross_Validates(t *testing.T) { - sdl2, err := ReadFile("../x/deployment/testdata/deployment-v2.yaml") - require.NoError(t, err) - dgroups, err := sdl2.DeploymentGroups() - require.NoError(t, err) - m, err := sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other. If this test fails at least one of the - // following is ture - // 1. Cross validation logic is wrong - // 2. The DeploymentGroups() & Manifest() code do not agree with one another - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - - // Repeat the same test with another file - sdl2, err = ReadFile("./_testdata/simple.yaml") - require.NoError(t, err) - dgroups, err = sdl2.DeploymentGroups() - require.NoError(t, err) - m, err = sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - - // Repeat the same test with another file - sdl2, err = ReadFile("./_testdata/simple3.yaml") - require.NoError(t, err) - dgroups, err = sdl2.DeploymentGroups() - require.NoError(t, err) - m, err = sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - - // Repeat the same test with another file - sdl2, err = ReadFile("./_testdata/private_service.yaml") - require.NoError(t, err) - dgroups, err = sdl2.DeploymentGroups() - require.NoError(t, err) - m, err = sdl2.Manifest() - require.NoError(t, err) - - // This is a single document producing both the manifest & deployment groups - // These should always agree with each other - err = m.CheckAgainstGSpecs(dgroups) - require.NoError(t, err) - -} - -func Test_V2_Parse_simple(t *testing.T) { - sdl, err := ReadFile("./_testdata/simple.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 1) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[0]) - - assert.Len(t, group.GetResourceUnits(), 1) - - assert.Equal(t, dtypes.ResourceUnit{ - Count: 2, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, group.GetResourceUnits()[0]) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - expectedHosts := make([]string, 1) - expectedHosts[0] = "ahostname.com" - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "web", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 2, - Expose: []manifest.ServiceExpose{ - {Port: 80, Global: true, Proto: manifest.TCP, Hosts: expectedHosts, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - {Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: manifest.ServiceExposeHTTPOptions{ - MaxBodySize: 1048576, - ReadTimeout: 60000, - SendTimeout: 60000, - NextTries: 3, - NextTimeout: 0, - NextCases: []string{"error", "timeout"}, - }}, - }, - }, - }, - }, mani.GetGroups()[0]) -} - -func Test_v1_Parse_ProfileNameNotServiceName(t *testing.T) { - sdl, err := ReadFile("./_testdata/profile-svc-name-mismatch.yaml") - require.NoError(t, err) - - dgroups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, dgroups, 1) - - mani, err := sdl.Manifest() - require.NoError(t, err) - assert.Len(t, mani.GetGroups(), 1) -} - -func Test_v2_Parse_DeploymentNameServiceNameMismatch(t *testing.T) { - sdl, err := ReadFile("./_testdata/deployment-svc-mismatch.yaml") - require.Error(t, err) - require.Nil(t, sdl) - require.Contains(t, err.Error(), "no service profile named") - - sdl, err = ReadFile("./_testdata/simple2.yaml") - require.NoError(t, err) - require.NotNil(t, sdl) - - dgroups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, dgroups, 1) - - mani, err := sdl.Manifest() - require.NoError(t, err) - assert.Len(t, mani.GetGroups(), 1) - - require.Equal(t, dgroups[0].Name, mani.GetGroups()[0].Name) - // SDL lists 2 services, but particular deployment specifies only one - require.Len(t, mani.GetGroups()[0].Services, 1) - - // make sure deployment maps to the right service - require.Len(t, mani.GetGroups()[0].Services[0].Expose, 2) - require.Len(t, mani.GetGroups()[0].Services[0].Expose[0].Hosts, 1) - require.Equal(t, mani.GetGroups()[0].Services[0].Expose[0].Hosts[0], "ahostname.com") -} - -func TestV2ParseServiceMix(t *testing.T) { - sdl, err := ReadFile("./_testdata/service-mix.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 2) - assert.Len(t, group.Requirements.Attributes, 2) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[1]) - - assert.Equal(t, dtypes.ResourceUnits{ - { - Count: 1, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(randGPU), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - { - Count: 1, - Resources: atypes.Resources{ - ID: 2, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - }, group.GetResourceUnits()) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "svca", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"ahostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - { - Name: "svcb", - Image: "nginx", - Resources: atypes.Resources{ - ID: 2, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"bhostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12346, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - }, - }, mani.GetGroups()[0]) -} - -func TestV2ParseServiceMix2(t *testing.T) { - sdl, err := ReadFile("./_testdata/service-mix2.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 2) - assert.Len(t, group.Requirements.Attributes, 2) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[1]) - - assert.Equal(t, dtypes.ResourceUnits{ - { - Count: 1, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(randGPU), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - { - Count: 1, - Resources: atypes.Resources{ - ID: 2, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(randGPU), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - }, group.GetResourceUnits()) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "svca", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"ahostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - { - Name: "svcb", - Image: "nginx", - Resources: atypes.Resources{ - ID: 2, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(1), - Attributes: atypes.Attributes{ - { - Key: "vendor/nvidia/model/*", - Value: "true", - }, - }, - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"bhostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12346, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - }, - }, mani.GetGroups()[0]) -} - -func TestV2ParseStorageName(t *testing.T) { - sdl, err := ReadFile("./_testdata/storageClass6.yaml") - require.NoError(t, err) - - groups, err := sdl.DeploymentGroups() - require.NoError(t, err) - assert.Len(t, groups, 1) - - group := groups[0] - assert.Len(t, group.GetResourceUnits(), 1) - assert.Len(t, group.Requirements.Attributes, 1) - - assert.Equal(t, atypes.Attribute{ - Key: "region", - Value: "us-west", - }, group.Requirements.Attributes[0]) - - assert.Equal(t, dtypes.ResourceUnits{ - { - Count: 1, - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(randCPU), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(randMemory), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(randStorage), - }, - { - Name: "configs", - Quantity: atypes.NewResourceValue(randStorage), - Attributes: atypes.Attributes{ - { - Key: "class", - Value: "default", - }, - { - Key: "persistent", - Value: "true", - }, - }, - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Price: AkashDecCoin(t, 50), - }, - }, group.GetResourceUnits()) - - mani, err := sdl.Manifest() - require.NoError(t, err) - - assert.Len(t, mani.GetGroups(), 1) - - assert.Equal(t, manifest.Group{ - Name: "westcoast", - Services: []manifest.Service{ - { - Name: "web", - Image: "nginx", - Resources: atypes.Resources{ - ID: 1, - CPU: &atypes.CPU{ - Units: atypes.NewResourceValue(100), - }, - GPU: &atypes.GPU{ - Units: atypes.NewResourceValue(0), - }, - Memory: &atypes.Memory{ - Quantity: atypes.NewResourceValue(128 * unit.Mi), - }, - Storage: atypes.Volumes{ - { - Name: "default", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - }, - { - Name: "configs", - Quantity: atypes.NewResourceValue(1 * unit.Gi), - Attributes: atypes.Attributes{ - { - Key: "class", - Value: "default", - }, - { - Key: "persistent", - Value: "true", - }, - }, - }, - }, - Endpoints: []atypes.Endpoint{ - { - Kind: atypes.Endpoint_SHARED_HTTP, - }, - { - Kind: atypes.Endpoint_RANDOM_PORT, - }, - }, - }, - Params: &manifest.ServiceParams{ - Storage: []manifest.StorageParams{ - { - Name: "configs", - Mount: "/test", - ReadOnly: false, - }, - }, - }, - Count: 1, - Expose: []manifest.ServiceExpose{ - { - Port: 80, Global: true, Proto: manifest.TCP, Hosts: []string{"ahostname.com"}, - HTTPOptions: defaultHTTPOptions, - }, - { - Port: 12345, Global: true, Proto: manifest.UDP, - HTTPOptions: defaultHTTPOptions, - }, - }, - }, - }, - }, mani.GetGroups()[0]) -} diff --git a/tests/upgrade/upgrade_test.go b/tests/upgrade/upgrade_test.go index 01af17d744..8a5a84fb0d 100644 --- a/tests/upgrade/upgrade_test.go +++ b/tests/upgrade/upgrade_test.go @@ -27,11 +27,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" // init sdk config - _ "github.com/akash-network/akash-api/go/sdkutil" + _ "pkg.akt.dev/go/sdkutil" - "github.com/akash-network/node/pubsub" - uttypes "github.com/akash-network/node/tests/upgrade/types" - "github.com/akash-network/node/util/cli" + "pkg.akt.dev/akashd/pubsub" + uttypes "pkg.akt.dev/akashd/tests/upgrade/types" + "pkg.akt.dev/akashd/util/cli" ) const ( diff --git a/tests/upgrade/v0.26.0/postupgrade.go b/tests/upgrade/v0.26.0/postupgrade.go index 7931e3da2d..35f3cbe8db 100644 --- a/tests/upgrade/v0.26.0/postupgrade.go +++ b/tests/upgrade/v0.26.0/postupgrade.go @@ -24,8 +24,8 @@ import ( astaking "github.com/akash-network/akash-api/go/node/staking/v1beta3" - "github.com/akash-network/node/app" - uttypes "github.com/akash-network/node/tests/upgrade/types" + "pkg.akt.dev/akashd/app" + uttypes "pkg.akt.dev/akashd/tests/upgrade/types" ) func init() { diff --git a/tests/upgrade/v0.32.0/postupgrade.go b/tests/upgrade/v0.32.0/postupgrade.go index 390649f183..f3c4c64eef 100644 --- a/tests/upgrade/v0.32.0/postupgrade.go +++ b/tests/upgrade/v0.32.0/postupgrade.go @@ -19,9 +19,9 @@ import ( cltypes "github.com/akash-network/akash-api/go/node/client/types" ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - "github.com/akash-network/node/app" - "github.com/akash-network/node/client" - uttypes "github.com/akash-network/node/tests/upgrade/types" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/client" + uttypes "pkg.akt.dev/akashd/tests/upgrade/types" ) func init() { diff --git a/tests/upgrade/v0.34.0/postupgrade.go b/tests/upgrade/v0.34.0/postupgrade.go index 80ceb65b96..614e700a0c 100644 --- a/tests/upgrade/v0.34.0/postupgrade.go +++ b/tests/upgrade/v0.34.0/postupgrade.go @@ -25,11 +25,11 @@ import ( cltypes "github.com/akash-network/akash-api/go/node/client/types" dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/node/app" - "github.com/akash-network/node/client" - "github.com/akash-network/node/cmd/common" - "github.com/akash-network/node/sdl" - uttypes "github.com/akash-network/node/tests/upgrade/types" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/client" + "pkg.akt.dev/akashd/cmd/common" + "pkg.akt.dev/akashd/sdl" + uttypes "pkg.akt.dev/akashd/tests/upgrade/types" ) const ( diff --git a/tests/upgrade/v0.36.0/postupgrade.go b/tests/upgrade/v0.36.0/postupgrade.go index 5ef3544a5d..169556805c 100644 --- a/tests/upgrade/v0.36.0/postupgrade.go +++ b/tests/upgrade/v0.36.0/postupgrade.go @@ -26,11 +26,12 @@ import ( cltypes "github.com/akash-network/akash-api/go/node/client/types" dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/node/app" - "github.com/akash-network/node/client" - "github.com/akash-network/node/cmd/common" - "github.com/akash-network/node/sdl" - uttypes "github.com/akash-network/node/tests/upgrade/types" + "pkg.akt.dev/go/sdl" + + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/client" + "pkg.akt.dev/akashd/cmd/common" + uttypes "pkg.akt.dev/akashd/tests/upgrade/types" ) const ( diff --git a/tests/upgrade/workers_test.go b/tests/upgrade/workers_test.go index babb166567..4d1eadfbb1 100644 --- a/tests/upgrade/workers_test.go +++ b/tests/upgrade/workers_test.go @@ -3,8 +3,8 @@ package upgrade import ( - _ "github.com/akash-network/node/tests/upgrade/v0.26.0" - _ "github.com/akash-network/node/tests/upgrade/v0.32.0" - _ "github.com/akash-network/node/tests/upgrade/v0.34.0" - _ "github.com/akash-network/node/tests/upgrade/v0.36.0" + _ "pkg.akt.dev/akashd/tests/upgrade/v0.26.0" + _ "pkg.akt.dev/akashd/tests/upgrade/v0.32.0" + _ "pkg.akt.dev/akashd/tests/upgrade/v0.34.0" + _ "pkg.akt.dev/akashd/tests/upgrade/v0.36.0" ) diff --git a/testutil/audit.go b/testutil/audit.go index 6f2cf16876..523ba0253d 100644 --- a/testutil/audit.go +++ b/testutil/audit.go @@ -3,7 +3,7 @@ package testutil import ( "testing" - atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" + atypes "pkg.akt.dev/go/node/audit/v1" ) func AuditedProvider(t testing.TB) (atypes.ProviderID, atypes.Provider) { diff --git a/testutil/base.go b/testutil/base.go index 564acd22e9..a206bcd6c6 100644 --- a/testutil/base.go +++ b/testutil/base.go @@ -4,14 +4,15 @@ import ( "fmt" "testing" + "github.com/cometbft/cometbft/libs/rand" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/libs/rand" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + attrv1 "pkg.akt.dev/go/node/types/attributes/v1" + types "pkg.akt.dev/go/node/types/resources/v1beta4" // ensure sdkutil.init() to seal SDK config for the tests - _ "github.com/akash-network/akash-api/go/sdkutil" + _ "pkg.akt.dev/go/sdkutil" ) // CoinDenom provides ability to create coins in test functions and @@ -35,17 +36,17 @@ func ProviderHostname(t testing.TB) string { } // Attribute generates a random sdk.Attribute -func Attribute(t testing.TB) types.Attribute { +func Attribute(t testing.TB) attrv1.Attribute { t.Helper() - return types.NewStringAttribute(Name(t, "attr-key"), Name(t, "attr-value")) + return attrv1.NewStringAttribute(Name(t, "attr-key"), Name(t, "attr-value")) } // Attributes generates a set of sdk.Attribute -func Attributes(t testing.TB) []types.Attribute { +func Attributes(t testing.TB) attrv1.Attributes { t.Helper() count := rand.Intn(10) + 1 - vals := make([]types.Attribute, 0, count) + vals := make(attrv1.Attributes, 0, count) for i := 0; i < count; i++ { vals = append(vals, Attribute(t)) } @@ -53,8 +54,8 @@ func Attributes(t testing.TB) []types.Attribute { } // PlacementRequirements generates placement requirements -func PlacementRequirements(t testing.TB) types.PlacementRequirements { - return types.PlacementRequirements{ +func PlacementRequirements(t testing.TB) attrv1.PlacementRequirements { + return attrv1.PlacementRequirements{ Attributes: Attributes(t), } } @@ -85,7 +86,7 @@ func RandStorageQuantity() uint64 { // Resources produces an attribute list for populating a Group's // 'Resources' fields. -func Resources(t testing.TB) []dtypes.ResourceUnit { +func Resources(t testing.TB) dtypes.ResourceUnits { t.Helper() count := rand.Intn(10) + 1 diff --git a/testutil/cert.go b/testutil/cert.go index 9a073c428a..7f6c6a593b 100644 --- a/testutil/cert.go +++ b/testutil/cert.go @@ -17,11 +17,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" + clientmocks "pkg.akt.dev/go/node/client/v1beta3/mocks" - clientmocks "github.com/akash-network/akash-api/go/node/client/v1beta2/mocks" - - certutils "github.com/akash-network/node/x/cert/utils" + certutils "pkg.akt.dev/akashd/x/cert/utils" ) type TestCertificate struct { @@ -185,7 +184,7 @@ func Certificate(t testing.TB, addr sdk.Address, opts ...CertificateOption) Test Filter: types.CertificateFilter{ Owner: addr.String(), Serial: res.Serial.String(), - State: "valid", + State: types.CertificateValid, }, }). Return(&types.QueryCertificatesResponse{ @@ -204,7 +203,7 @@ func Certificate(t testing.TB, addr sdk.Address, opts ...CertificateOption) Test return res } -func CertificateRequireEqualResponse(t *testing.T, cert TestCertificate, resp types.CertificateResponse, state types.Certificate_State) { +func CertificateRequireEqualResponse(t *testing.T, cert TestCertificate, resp types.CertificateResponse, state types.State) { t.Helper() require.Equal(t, state, resp.Certificate.State) diff --git a/testutil/cli/cmd.go b/testutil/cli/cmd.go index 20452b7589..4c80ab5542 100644 --- a/testutil/cli/cmd.go +++ b/testutil/cli/cmd.go @@ -5,17 +5,15 @@ import ( "context" "testing" - "github.com/cosmos/cosmos-sdk/server" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/gogo/protobuf/jsonpb" - + "github.com/spf13/cobra" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/testutil" - "github.com/spf13/cobra" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + "github.com/cosmos/gogoproto/jsonpb" ) // ExecTestCLICmd builds the client context, mocks the output and executes the command. diff --git a/testutil/cosmos/keepers.go b/testutil/cosmos/keepers.go index 943959bff4..338b6dc646 100644 --- a/testutil/cosmos/keepers.go +++ b/testutil/cosmos/keepers.go @@ -29,6 +29,6 @@ type DistrKeeper interface { //go:generate mockery --name AuthzKeeper --output ./mocks type AuthzKeeper interface { DeleteGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) error - GetCleanAuthorization(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) (cap authz.Authorization, expiration time.Time) - SaveGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration time.Time) error + GetAuthorization(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) (cap authz.Authorization, expiration *time.Time) + SaveGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration *time.Time) error } diff --git a/testutil/cosmos/mocks/authz_keeper.go b/testutil/cosmos/mocks/authz_keeper.go index 2109d51ead..fdc779f52d 100644 --- a/testutil/cosmos/mocks/authz_keeper.go +++ b/testutil/cosmos/mocks/authz_keeper.go @@ -74,17 +74,17 @@ func (_c *AuthzKeeper_DeleteGrant_Call) RunAndReturn(run func(types.Context, typ return _c } -// GetCleanAuthorization provides a mock function with given fields: ctx, grantee, granter, msgType -func (_m *AuthzKeeper) GetCleanAuthorization(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) (authz.Authorization, time.Time) { +// GetAuthorization provides a mock function with given fields: ctx, grantee, granter, msgType +func (_m *AuthzKeeper) GetAuthorization(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) (authz.Authorization, *time.Time) { ret := _m.Called(ctx, grantee, granter, msgType) if len(ret) == 0 { - panic("no return value specified for GetCleanAuthorization") + panic("no return value specified for GetAuthorization") } var r0 authz.Authorization - var r1 time.Time - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, time.Time)); ok { + var r1 *time.Time + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, *time.Time)); ok { return rf(ctx, grantee, granter, msgType) } if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) authz.Authorization); ok { @@ -95,48 +95,50 @@ func (_m *AuthzKeeper) GetCleanAuthorization(ctx types.Context, grantee types.Ac } } - if rf, ok := ret.Get(1).(func(types.Context, types.AccAddress, types.AccAddress, string) time.Time); ok { + if rf, ok := ret.Get(1).(func(types.Context, types.AccAddress, types.AccAddress, string) *time.Time); ok { r1 = rf(ctx, grantee, granter, msgType) } else { - r1 = ret.Get(1).(time.Time) + if ret.Get(1) != nil { + r1 = ret.Get(1).(*time.Time) + } } return r0, r1 } -// AuthzKeeper_GetCleanAuthorization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCleanAuthorization' -type AuthzKeeper_GetCleanAuthorization_Call struct { +// AuthzKeeper_GetAuthorization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthorization' +type AuthzKeeper_GetAuthorization_Call struct { *mock.Call } -// GetCleanAuthorization is a helper method to define mock.On call +// GetAuthorization is a helper method to define mock.On call // - ctx types.Context // - grantee types.AccAddress // - granter types.AccAddress // - msgType string -func (_e *AuthzKeeper_Expecter) GetCleanAuthorization(ctx interface{}, grantee interface{}, granter interface{}, msgType interface{}) *AuthzKeeper_GetCleanAuthorization_Call { - return &AuthzKeeper_GetCleanAuthorization_Call{Call: _e.mock.On("GetCleanAuthorization", ctx, grantee, granter, msgType)} +func (_e *AuthzKeeper_Expecter) GetAuthorization(ctx interface{}, grantee interface{}, granter interface{}, msgType interface{}) *AuthzKeeper_GetAuthorization_Call { + return &AuthzKeeper_GetAuthorization_Call{Call: _e.mock.On("GetAuthorization", ctx, grantee, granter, msgType)} } -func (_c *AuthzKeeper_GetCleanAuthorization_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string)) *AuthzKeeper_GetCleanAuthorization_Call { +func (_c *AuthzKeeper_GetAuthorization_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string)) *AuthzKeeper_GetAuthorization_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(string)) }) return _c } -func (_c *AuthzKeeper_GetCleanAuthorization_Call) Return(cap authz.Authorization, expiration time.Time) *AuthzKeeper_GetCleanAuthorization_Call { +func (_c *AuthzKeeper_GetAuthorization_Call) Return(cap authz.Authorization, expiration *time.Time) *AuthzKeeper_GetAuthorization_Call { _c.Call.Return(cap, expiration) return _c } -func (_c *AuthzKeeper_GetCleanAuthorization_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, time.Time)) *AuthzKeeper_GetCleanAuthorization_Call { +func (_c *AuthzKeeper_GetAuthorization_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, *time.Time)) *AuthzKeeper_GetAuthorization_Call { _c.Call.Return(run) return _c } // SaveGrant provides a mock function with given fields: ctx, grantee, granter, authorization, expiration -func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration time.Time) error { +func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration *time.Time) error { ret := _m.Called(ctx, grantee, granter, authorization, expiration) if len(ret) == 0 { @@ -144,7 +146,7 @@ func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, gr } var r0 error - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, time.Time) error); ok { + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, *time.Time) error); ok { r0 = rf(ctx, grantee, granter, authorization, expiration) } else { r0 = ret.Error(0) @@ -163,14 +165,14 @@ type AuthzKeeper_SaveGrant_Call struct { // - grantee types.AccAddress // - granter types.AccAddress // - authorization authz.Authorization -// - expiration time.Time +// - expiration *time.Time func (_e *AuthzKeeper_Expecter) SaveGrant(ctx interface{}, grantee interface{}, granter interface{}, authorization interface{}, expiration interface{}) *AuthzKeeper_SaveGrant_Call { return &AuthzKeeper_SaveGrant_Call{Call: _e.mock.On("SaveGrant", ctx, grantee, granter, authorization, expiration)} } -func (_c *AuthzKeeper_SaveGrant_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration time.Time)) *AuthzKeeper_SaveGrant_Call { +func (_c *AuthzKeeper_SaveGrant_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration *time.Time)) *AuthzKeeper_SaveGrant_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(authz.Authorization), args[4].(time.Time)) + run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(authz.Authorization), args[4].(*time.Time)) }) return _c } @@ -180,7 +182,7 @@ func (_c *AuthzKeeper_SaveGrant_Call) Return(_a0 error) *AuthzKeeper_SaveGrant_C return _c } -func (_c *AuthzKeeper_SaveGrant_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, time.Time) error) *AuthzKeeper_SaveGrant_Call { +func (_c *AuthzKeeper_SaveGrant_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, *time.Time) error) *AuthzKeeper_SaveGrant_Call { _c.Call.Return(run) return _c } diff --git a/testutil/deployment.go b/testutil/deployment.go index 9e12036a9b..a3abe77c99 100644 --- a/testutil/deployment.go +++ b/testutil/deployment.go @@ -5,33 +5,34 @@ import ( "math/rand" "testing" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + dtypes "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" ) // sum256Seed provides a consistent sha256 value for initial Deployment.Version const sum256Seed = "hihi" -// DefaultDeploymentVersion provides consistent sha256 sum for initial Deployment.Version -var DefaultDeploymentVersion = sha256.Sum256([]byte(sum256Seed)) +// DefaultDeploymentHash provides consistent sha256 sum for initial Deployment.Hash +var DefaultDeploymentHash = sha256.Sum256([]byte(sum256Seed)) // Deployment generates a dtype.Deployment in state `DeploymentActive` func Deployment(t testing.TB) dtypes.Deployment { t.Helper() return dtypes.Deployment{ - DeploymentID: DeploymentID(t), - State: dtypes.DeploymentActive, - Version: DefaultDeploymentVersion[:], + ID: DeploymentID(t), + State: dtypes.DeploymentActive, + Hash: DefaultDeploymentHash[:], } } // DeploymentGroup generates a dtype.DepDeploymentGroup in state `GroupOpen` // with a set of random required attributes -func DeploymentGroup(t testing.TB, did dtypes.DeploymentID, gseq uint32) dtypes.Group { +func DeploymentGroup(t testing.TB, did dtypes.DeploymentID, gseq uint32) v1beta4.Group { t.Helper() - return dtypes.Group{ - GroupID: dtypes.MakeGroupID(did, gseq), - State: dtypes.GroupOpen, - GroupSpec: dtypes.GroupSpec{ + return v1beta4.Group{ + ID: dtypes.MakeGroupID(did, gseq), + State: v1beta4.GroupOpen, + GroupSpec: v1beta4.GroupSpec{ Name: Name(t, "dgroup"), Requirements: PlacementRequirements(t), Resources: Resources(t), @@ -40,9 +41,9 @@ func DeploymentGroup(t testing.TB, did dtypes.DeploymentID, gseq uint32) dtypes. } // GroupSpec generator -func GroupSpec(t testing.TB) dtypes.GroupSpec { +func GroupSpec(t testing.TB) v1beta4.GroupSpec { t.Helper() - return dtypes.GroupSpec{ + return v1beta4.GroupSpec{ Name: Name(t, "dgroup"), Requirements: PlacementRequirements(t), Resources: Resources(t), @@ -50,10 +51,10 @@ func GroupSpec(t testing.TB) dtypes.GroupSpec { } // DeploymentGroups returns a set of deployment groups generated by DeploymentGroup -func DeploymentGroups(t testing.TB, did dtypes.DeploymentID, gseq uint32) []dtypes.Group { +func DeploymentGroups(t testing.TB, did dtypes.DeploymentID, gseq uint32) v1beta4.Groups { t.Helper() count := rand.Intn(5) + 5 // nolint:gosec - vals := make([]dtypes.Group, 0, count) + vals := make(v1beta4.Groups, 0, count) for i := 0; i < count; i++ { vals = append(vals, DeploymentGroup(t, did, gseq+uint32(i))) } diff --git a/testutil/event.go b/testutil/event.go index 0597fea6f9..d12d5809f3 100644 --- a/testutil/event.go +++ b/testutil/event.go @@ -1,60 +1,60 @@ package testutil -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - "github.com/akash-network/akash-api/go/sdkutil" -) - -func ParseEvent(t testing.TB, events []abci.Event) sdkutil.Event { - t.Helper() - - require.Equal(t, 1, len(events)) - - sev := sdk.StringifyEvent(events[0]) - ev, err := sdkutil.ParseEvent(sev) - - require.NoError(t, err) - - return ev -} - -func ParseDeploymentEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent { - t.Helper() - - uev := ParseEvent(t, events) - - iev, err := dtypes.ParseEvent(uev) - require.NoError(t, err) - - return iev -} - -func ParseMarketEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent { - t.Helper() - - uev := ParseEvent(t, events) - - iev, err := mtypes.ParseEvent(uev) - require.NoError(t, err) - - return iev -} - -func ParseProviderEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent { - t.Helper() - - uev := ParseEvent(t, events) - - iev, err := ptypes.ParseEvent(uev) - require.NoError(t, err) - - return iev -} +// import ( +// "testing" +// +// abci "github.com/cometbft/cometbft/abci/types" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/stretchr/testify/require" +// +// dtypes "pkg.akt.dev/go/node/deployment/v1beta4" +// mtypes "pkg.akt.dev/go/node/market/v1beta5" +// ptypes "pkg.akt.dev/go/node/provider/v1beta4" +// "pkg.akt.dev/go/sdkutil" +// ) +// +// func ParseEvent(t testing.TB, events []abci.Event) sdkutil.Event { +// t.Helper() +// +// require.Equal(t, 1, len(events)) +// +// sev := sdk.StringifyEvent(events[0]) +// ev, err := sdkutil.ParseEvent(sev) +// +// require.NoError(t, err) +// +// return ev +// } +// +// func ParseDeploymentEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent { +// t.Helper() +// +// uev := ParseEvent(t, events) +// +// iev, err := dtypes.ParseEvent(uev) +// require.NoError(t, err) +// +// return iev +// } +// +// func ParseMarketEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent { +// t.Helper() +// +// uev := ParseEvent(t, events) +// +// iev, err := mtypes.ParseEvent(uev) +// require.NoError(t, err) +// +// return iev +// } +// +// func ParseProviderEvent(t testing.TB, events []abci.Event) sdkutil.ModuleEvent { +// t.Helper() +// +// uev := ParseEvent(t, events) +// +// iev, err := ptypes.ParseEvent(uev) +// require.NoError(t, err) +// +// return iev +// } diff --git a/testutil/ids.go b/testutil/ids.go index 6ed7fa10f7..0f4d9bbab0 100644 --- a/testutil/ids.go +++ b/testutil/ids.go @@ -6,17 +6,18 @@ import ( "math/rand" "testing" + "github.com/cometbft/cometbft/crypto/ed25519" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto/ed25519" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" + dtypes "pkg.akt.dev/go/node/deployment/v1" + mtypes "pkg.akt.dev/go/node/market/v1" ) -func Keyring(t testing.TB) keyring.Keyring { +func Keyring(t testing.TB, cdc codec.Codec) keyring.Keyring { t.Helper() - obj := keyring.NewInMemory() + obj := keyring.NewInMemory(cdc) return obj } diff --git a/testutil/log.go b/testutil/log.go index 3935d5e078..294aeaa84c 100644 --- a/testutil/log.go +++ b/testutil/log.go @@ -4,7 +4,7 @@ import ( "sync" "testing" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" ) func Logger(t testing.TB) log.Logger { diff --git a/testutil/network/network.go b/testutil/network/network.go index 6d15ac4853..e004c3c268 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -17,14 +17,14 @@ import ( "github.com/stretchr/testify/require" - tmcfg "github.com/tendermint/tendermint/config" - tmflags "github.com/tendermint/tendermint/libs/cli/flags" - "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tendermint/node" - tmclient "github.com/tendermint/tendermint/rpc/client" - cmtrpc "github.com/tendermint/tendermint/rpc/core" - cmtrpcsrv "github.com/tendermint/tendermint/rpc/jsonrpc/server" - dbm "github.com/tendermint/tm-db" + dbm "github.com/cometbft/cometbft-db" + tmcfg "github.com/cometbft/cometbft/config" + tmflags "github.com/cometbft/cometbft/libs/cli/flags" + "github.com/cometbft/cometbft/libs/log" + "github.com/cometbft/cometbft/node" + tmclient "github.com/cometbft/cometbft/rpc/client" + cmtrpc "github.com/cometbft/cometbft/rpc/core" + cmtrpcsrv "github.com/cometbft/cometbft/rpc/jsonrpc/server" "google.golang.org/grpc" "github.com/cosmos/cosmos-sdk/baseapp" @@ -38,8 +38,6 @@ import ( "github.com/cosmos/cosmos-sdk/server/api" srvconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/simapp/params" storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" @@ -48,7 +46,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/akash-network/node/client" + "pkg.akt.dev/akashd/client" ) func init() { diff --git a/testutil/network/util.go b/testutil/network/util.go index bdc6d72065..c9843d7b11 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -5,14 +5,14 @@ import ( "path/filepath" "time" - tmos "github.com/tendermint/tendermint/libs/os" - "github.com/tendermint/tendermint/node" - "github.com/tendermint/tendermint/p2p" - pvm "github.com/tendermint/tendermint/privval" - "github.com/tendermint/tendermint/proxy" - "github.com/tendermint/tendermint/rpc/client/local" - "github.com/tendermint/tendermint/types" - tmtime "github.com/tendermint/tendermint/types/time" + tmos "github.com/cometbft/cometbft/libs/os" + "github.com/cometbft/cometbft/node" + "github.com/cometbft/cometbft/p2p" + pvm "github.com/cometbft/cometbft/privval" + "github.com/cometbft/cometbft/proxy" + "github.com/cometbft/cometbft/rpc/client/local" + "github.com/cometbft/cometbft/types" + tmtime "github.com/cometbft/cometbft/types/time" "github.com/cosmos/cosmos-sdk/server/api" servergrpc "github.com/cosmos/cosmos-sdk/server/grpc" diff --git a/testutil/network_suite.go b/testutil/network_suite.go index 670af7bfe7..dd6c736e92 100644 --- a/testutil/network_suite.go +++ b/testutil/network_suite.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/gogo/protobuf/jsonpb" + "github.com/cosmos/gogoproto/jsonpb" "github.com/spf13/pflag" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -23,7 +23,7 @@ import ( cosmosauthtx "github.com/cosmos/cosmos-sdk/x/auth/tx" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/akash-network/node/testutil/network" + "pkg.akt.dev/akashd/testutil/network" ) type NetworkTestSuite struct { diff --git a/testutil/provider.go b/testutil/provider.go index 49d41f4637..56e8a3cef7 100644 --- a/testutil/provider.go +++ b/testutil/provider.go @@ -3,7 +3,7 @@ package testutil import ( "testing" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" + ptypes "pkg.akt.dev/go/node/provider/v1beta3" ) func Provider(t testing.TB) ptypes.Provider { diff --git a/testutil/state/suite.go b/testutil/state/suite.go index e80f70b605..a42715587d 100644 --- a/testutil/state/suite.go +++ b/testutil/state/suite.go @@ -3,28 +3,31 @@ package state import ( "testing" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/stretchr/testify/mock" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/stretchr/testify/mock" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" - ttypes "github.com/akash-network/akash-api/go/node/take/v1beta3" - - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - - "github.com/akash-network/node/app" - emocks "github.com/akash-network/node/testutil/cosmos/mocks" - akeeper "github.com/akash-network/node/x/audit/keeper" - dkeeper "github.com/akash-network/node/x/deployment/keeper" - ekeeper "github.com/akash-network/node/x/escrow/keeper" - mhooks "github.com/akash-network/node/x/market/hooks" - mkeeper "github.com/akash-network/node/x/market/keeper" - pkeeper "github.com/akash-network/node/x/provider/keeper" - tkeeper "github.com/akash-network/node/x/take/keeper" + + atypes "pkg.akt.dev/go/node/audit/v1" + dtypes "pkg.akt.dev/go/node/deployment/v1" + etypes "pkg.akt.dev/go/node/escrow/v1" + mtypes "pkg.akt.dev/go/node/market/v1beta5" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" + ttypes "pkg.akt.dev/go/node/take/v1beta3" + + "pkg.akt.dev/akashd/app" + + emocks "pkg.akt.dev/akashd/testutil/cosmos/mocks" + akeeper "pkg.akt.dev/akashd/x/audit/keeper" + dkeeper "pkg.akt.dev/akashd/x/deployment/keeper" + ekeeper "pkg.akt.dev/akashd/x/escrow/keeper" + mhooks "pkg.akt.dev/akashd/x/market/hooks" + mkeeper "pkg.akt.dev/akashd/x/market/keeper" + pkeeper "pkg.akt.dev/akashd/x/provider/keeper" + tkeeper "pkg.akt.dev/akashd/x/take/keeper" ) // TestSuite encapsulates a functional Akash nodes data stores for @@ -56,6 +59,8 @@ func SetupTestSuite(t testing.TB) *TestSuite { } func SetupTestSuiteWithKeepers(t testing.TB, keepers Keepers) *TestSuite { + cdc := codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + if keepers.Bank == nil { bkeeper := &emocks.BankKeeper{} bkeeper. @@ -90,24 +95,24 @@ func SetupTestSuiteWithKeepers(t testing.TB, keepers Keepers) *TestSuite { app := app.Setup(false) if keepers.Audit == nil { - keepers.Audit = akeeper.NewKeeper(atypes.ModuleCdc, app.GetKey(atypes.StoreKey)) + keepers.Audit = akeeper.NewKeeper(cdc, app.GetKey(atypes.StoreKey)) } if keepers.Take == nil { - keepers.Take = tkeeper.NewKeeper(ttypes.ModuleCdc, app.GetKey(ttypes.StoreKey), app.GetSubspace(ttypes.ModuleName)) + keepers.Take = tkeeper.NewKeeper(cdc, app.GetKey(ttypes.StoreKey), app.GetSubspace(ttypes.ModuleName)) } if keepers.Escrow == nil { - keepers.Escrow = ekeeper.NewKeeper(etypes.ModuleCdc, app.GetKey(etypes.StoreKey), keepers.Bank, keepers.Take, keepers.Distr, keepers.Authz) + keepers.Escrow = ekeeper.NewKeeper(cdc, app.GetKey(etypes.StoreKey), keepers.Bank, keepers.Take, keepers.Distr, keepers.Authz) } if keepers.Market == nil { - keepers.Market = mkeeper.NewKeeper(mtypes.ModuleCdc, app.GetKey(mtypes.StoreKey), app.GetSubspace(mtypes.ModuleName), keepers.Escrow) + keepers.Market = mkeeper.NewKeeper(cdc, app.GetKey(mtypes.StoreKey), app.GetSubspace(mtypes.ModuleName), keepers.Escrow) } if keepers.Deployment == nil { - keepers.Deployment = dkeeper.NewKeeper(dtypes.ModuleCdc, app.GetKey(dtypes.StoreKey), app.GetSubspace(dtypes.ModuleName), keepers.Escrow) + keepers.Deployment = dkeeper.NewKeeper(cdc, app.GetKey(dtypes.StoreKey), app.GetSubspace(dtypes.ModuleName), keepers.Escrow) } if keepers.Provider == nil { - keepers.Provider = pkeeper.NewKeeper(ptypes.ModuleCdc, app.GetKey(ptypes.StoreKey)) + keepers.Provider = pkeeper.NewKeeper(cdc, app.GetKey(ptypes.StoreKey)) } hook := mhooks.New(keepers.Deployment, keepers.Market) diff --git a/testutil/types.go b/testutil/types.go index 5199dec5cf..d0ab572236 100644 --- a/testutil/types.go +++ b/testutil/types.go @@ -14,18 +14,18 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/simapp" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + types "pkg.akt.dev/go/node/types/v1beta3" - tmrand "github.com/tendermint/tendermint/libs/rand" - dbm "github.com/tendermint/tm-db" + dbm "github.com/cometbft/cometbft-db" + tmrand "github.com/cometbft/cometbft/libs/rand" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" + rtypes "pkg.akt.dev/go/node/types/resources/v1beta4" - "github.com/akash-network/node/app" - "github.com/akash-network/node/testutil/network" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/testutil/network" ) type InterceptState func(codec.Codec, string, json.RawMessage) json.RawMessage @@ -61,21 +61,21 @@ func RandRangeUint64(min, max uint64) uint64 { return val } -func ResourceUnits(_ testing.TB) types.Resources { - return types.Resources{ +func ResourceUnits(_ testing.TB) rtypes.Resources { + return rtypes.Resources{ ID: 1, - CPU: &types.CPU{ - Units: types.NewResourceValue(uint64(RandCPUUnits())), + CPU: &rtypes.CPU{ + Units: rtypes.NewResourceValue(uint64(RandCPUUnits())), }, - Memory: &types.Memory{ - Quantity: types.NewResourceValue(RandMemoryQuantity()), + Memory: &rtypes.Memory{ + Quantity: rtypes.NewResourceValue(RandMemoryQuantity()), }, - GPU: &types.GPU{ - Units: types.NewResourceValue(uint64(RandGPUUnits())), + GPU: &rtypes.GPU{ + Units: rtypes.NewResourceValue(uint64(RandGPUUnits())), }, - Storage: types.Volumes{ - types.Storage{ - Quantity: types.NewResourceValue(RandStorageQuantity()), + Storage: rtypes.Volumes{ + rtypes.Storage{ + Quantity: rtypes.NewResourceValue(RandStorageQuantity()), }, }, } @@ -84,7 +84,7 @@ func ResourceUnits(_ testing.TB) types.Resources { func NewApp(val network.Validator) servertypes.Application { return app.NewApp( val.Ctx.Logger, dbm.NewMemDB(), nil, true, 0, make(map[int64]bool), val.Ctx.Config.RootDir, - simapp.EmptyAppOptions{}, + // simapp.EmptyAppOptions{}, baseapp.SetPruning(storetypes.NewPruningOptionsFromString(val.AppConfig.Pruning)), baseapp.SetMinGasPrices(val.AppConfig.MinGasPrices), ) diff --git a/tools/upgrade-info/main.go b/tools/upgrade-info/main.go index 18084045c7..9fe0b8733f 100644 --- a/tools/upgrade-info/main.go +++ b/tools/upgrade-info/main.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" - utilcli "github.com/akash-network/node/util/cli" + utilcli "pkg.akt.dev/akashd/util/cli" ) func main() { diff --git a/upgrades/software/v0.15.0/audit.go b/upgrades/software/v0.15.0/audit.go deleted file mode 100644 index 27b1cf17b8..0000000000 --- a/upgrades/software/v0.15.0/audit.go +++ /dev/null @@ -1,34 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - v043 "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" - - av1beta2 "github.com/akash-network/akash-api/go/node/audit/v1beta2" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type auditMigrations struct { - utypes.Migrator -} - -func newAuditMigration(m utypes.Migrator) utypes.Migration { - return auditMigrations{Migrator: m} -} - -func (m auditMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates provider from version 1 to 2. -func (m auditMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - v043.MigratePrefixAddressAddress(store, av1beta2.PrefixProviderID()) - - return nil -} diff --git a/upgrades/software/v0.15.0/cert.go b/upgrades/software/v0.15.0/cert.go deleted file mode 100644 index dd3997458b..0000000000 --- a/upgrades/software/v0.15.0/cert.go +++ /dev/null @@ -1,34 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - v043 "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v043" - - cv1beta2 "github.com/akash-network/akash-api/go/node/cert/v1beta2" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type certMigrations struct { - utypes.Migrator -} - -func newCertMigration(m utypes.Migrator) utypes.Migration { - return certMigrations{Migrator: m} -} - -func (m certMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates provider from version 1 to 2. -func (m certMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - v043.MigratePrefixAddressAddress(store, cv1beta2.PrefixCertificateID()) - - return nil -} diff --git a/upgrades/software/v0.15.0/deployment.go b/upgrades/software/v0.15.0/deployment.go deleted file mode 100644 index 6d14e49acb..0000000000 --- a/upgrades/software/v0.15.0/deployment.go +++ /dev/null @@ -1,48 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - dv1beta1 "github.com/akash-network/akash-api/go/node/deployment/v1beta1" - dmigrate "github.com/akash-network/akash-api/go/node/deployment/v1beta2/migrate" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type deploymentMigrations struct { - utypes.Migrator -} - -func newDeploymentMigration(m utypes.Migrator) utypes.Migration { - return deploymentMigrations{Migrator: m} -} - -func (m deploymentMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates deployment from version 1 to 2. -func (m deploymentMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - migratePrefixBech32AddrBytes(store, dv1beta1.DeploymentPrefix()) - migratePrefixBech32AddrBytes(store, dv1beta1.GroupPrefix()) - - err := utypes.MigrateValue(store, m.Codec(), dv1beta1.GroupPrefix(), migrateDeploymentGroup) - if err != nil { - return err - } - - return nil -} - -func migrateDeploymentGroup(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var from dv1beta1.Group - cdc.MustUnmarshal(fromBz, &from) - - to := dmigrate.GroupFromV1Beta1(from) - return &to -} diff --git a/upgrades/software/v0.15.0/escrow.go b/upgrades/software/v0.15.0/escrow.go deleted file mode 100644 index 8ec2a73ce6..0000000000 --- a/upgrades/software/v0.15.0/escrow.go +++ /dev/null @@ -1,84 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - ev1beta1 "github.com/akash-network/akash-api/go/node/escrow/v1beta1" - ev1beta2 "github.com/akash-network/akash-api/go/node/escrow/v1beta2" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type escrowMigrations struct { - utypes.Migrator -} - -func newEscrowMigration(m utypes.Migrator) utypes.Migration { - return escrowMigrations{Migrator: m} -} - -func (m escrowMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates deployment from version 1 to 2. -func (m escrowMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - err := utypes.MigrateValue(store, m.Codec(), ev1beta2.AccountKeyPrefix(), migrateAccount) - if err != nil { - return err - } - - err = utypes.MigrateValue(store, m.Codec(), ev1beta2.PaymentKeyPrefix(), migratePayment) - if err != nil { - return err - } - - return nil -} - -func migrateAccount(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var from ev1beta1.Account - cdc.MustUnmarshal(fromBz, &from) - to := ev1beta2.Account{ - ID: ev1beta2.AccountID{ - Scope: from.ID.Scope, - XID: from.ID.XID, - }, - Owner: from.Owner, - State: ev1beta2.Account_State(from.State), - Balance: sdk.NewDecCoinFromCoin(from.Balance), - Transferred: sdk.NewDecCoinFromCoin(from.Transferred), - SettledAt: from.SettledAt, - // Correctly initialize the new fields - // - Account.Depositor as Account.Owner - // - Account.Funds as a DecCoin of zero value - Depositor: from.Owner, - Funds: sdk.NewDecCoin(from.Balance.Denom, sdk.ZeroInt()), - } - - return &to -} - -func migratePayment(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var from ev1beta1.Payment - cdc.MustUnmarshal(fromBz, &from) - - return &ev1beta2.FractionalPayment{ - AccountID: ev1beta2.AccountID{ - Scope: from.AccountID.Scope, - XID: from.AccountID.XID, - }, - PaymentID: from.PaymentID, - Owner: from.Owner, - State: ev1beta2.FractionalPayment_State(from.State), - Rate: sdk.NewDecCoinFromCoin(from.Rate), - Balance: sdk.NewDecCoinFromCoin(from.Balance), - Withdrawn: from.Withdrawn, - } -} diff --git a/upgrades/software/v0.15.0/helpers.go b/upgrades/software/v0.15.0/helpers.go deleted file mode 100644 index efd54ae40b..0000000000 --- a/upgrades/software/v0.15.0/helpers.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" -) - -const ( - V014Bech32AddrLen = 44 // length of an akash address when encoded as a bech32 string in v0.14 -) - -// migratePrefixBech32AddrBytes is a helper function that migrates all keys of format: -// prefix_bytes | address_bech32_bytes | arbitrary_bytes -// into format: -// prefix_bytes | address_len (1 byte) | address_bytes | arbitrary_bytes -func migratePrefixBech32AddrBytes(store sdk.KVStore, prefixBz []byte) { - oldStore := prefix.NewStore(store, prefixBz) - - oldStoreIter := oldStore.Iterator(nil, nil) - defer func() { - _ = oldStoreIter.Close() - }() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - bech32Addr := string(oldStoreIter.Key()[:V014Bech32AddrLen]) - addr, err := sdk.AccAddressFromBech32(bech32Addr) - if err != nil { - panic(err) - } - - endBz := oldStoreIter.Key()[V014Bech32AddrLen:] - newStoreKey := append(append(prefixBz, address.MustLengthPrefix(addr)...), endBz...) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - oldStore.Delete(oldStoreIter.Key()) - } -} diff --git a/upgrades/software/v0.15.0/init.go b/upgrades/software/v0.15.0/init.go deleted file mode 100644 index 2e3d4e4e8a..0000000000 --- a/upgrades/software/v0.15.0/init.go +++ /dev/null @@ -1,25 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - av1beta2 "github.com/akash-network/akash-api/go/node/audit/v1beta2" - cv1beta2 "github.com/akash-network/akash-api/go/node/cert/v1beta2" - dv1beta2 "github.com/akash-network/akash-api/go/node/deployment/v1beta2" - ev1beta2 "github.com/akash-network/akash-api/go/node/escrow/v1beta2" - mv1beta2 "github.com/akash-network/akash-api/go/node/market/v1beta2" - pv1beta2 "github.com/akash-network/akash-api/go/node/provider/v1beta2" - - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(upgradeName, initUpgrade) - - utypes.RegisterMigration(av1beta2.ModuleName, 1, newAuditMigration) - utypes.RegisterMigration(cv1beta2.ModuleName, 1, newCertMigration) - utypes.RegisterMigration(dv1beta2.ModuleName, 1, newDeploymentMigration) - utypes.RegisterMigration(mv1beta2.ModuleName, 1, newMarketMigration) - utypes.RegisterMigration(pv1beta2.ModuleName, 1, newProviderMigration) - utypes.RegisterMigration(ev1beta2.ModuleName, 1, newEscrowMigration) -} diff --git a/upgrades/software/v0.15.0/market.go b/upgrades/software/v0.15.0/market.go deleted file mode 100644 index 230b5b04bb..0000000000 --- a/upgrades/software/v0.15.0/market.go +++ /dev/null @@ -1,183 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - dmigrate "github.com/akash-network/akash-api/go/node/deployment/v1beta2/migrate" - mv1beta1 "github.com/akash-network/akash-api/go/node/market/v1beta1" - mv1beta2 "github.com/akash-network/akash-api/go/node/market/v1beta2" - - utypes "github.com/akash-network/node/upgrades/types" - keys "github.com/akash-network/node/x/market/keeper/keys/v1beta2" -) - -type marketMigrations struct { - utypes.Migrator -} - -func newMarketMigration(m utypes.Migrator) utypes.Migration { - return marketMigrations{Migrator: m} -} - -func (m marketMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates market from version 1 to 2. -func (m marketMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - // Change addresses to be length-prefixed - migratePrefixBech32AddrBytes(store, mv1beta1.OrderPrefix()) - err := migratePrefixBech32Uint64Uint32Uint32Bech32(store, mv1beta1.BidPrefix()) - if err != nil { - return err - } - - err = migratePrefixBech32Uint64Uint32Uint32Bech32(store, mv1beta1.LeasePrefix()) - if err != nil { - return err - } - - // Migrate protobuf - err = utypes.MigrateValue(store, m.Codec(), mv1beta1.OrderPrefix(), migrateOrder) - if err != nil { - return err - } - - err = utypes.MigrateValue(store, m.Codec(), mv1beta1.BidPrefix(), migrateBid) - if err != nil { - return err - } - - err = utypes.MigrateValue(store, m.Codec(), mv1beta1.LeasePrefix(), migrateLease) - if err != nil { - return err - } - - // add the mapping of secondary lease key -> lease key - addSecondaryLeaseKeys(store, m.Codec()) - - return nil -} - -func addSecondaryLeaseKeys(baseStore sdk.KVStore, cdc codec.BinaryCodec) { - store := prefix.NewStore(baseStore, mv1beta2.LeasePrefix()) - - iter := sdk.KVStorePrefixIterator(store, mv1beta2.LeasePrefix()) - defer func() { - _ = iter.Close() - }() - - for ; iter.Valid(); iter.Next() { - var from mv1beta2.Lease - cdc.MustUnmarshal(iter.Value(), &from) - - leaseKey := keys.LeaseKey(from.GetLeaseID()) - for _, secondaryKey := range keys.SecondaryKeysForLease(from.GetLeaseID()) { - store.Set(secondaryKey, leaseKey) - } - } -} - -// migratePrefixBech32Uint64Uint32Uint32Bech32 is a helper function that migrates all keys of format: -// prefix_bytes | address1_bech32_bytes | uint64 | uint32 | uint32 | address2_bech32_bytes -// into format: -// prefix_bytes | address1_len (1 byte) | address1_bytes | uint64 | uint32 | uint32 | address2_len (1 byte) | address2_bytes -func migratePrefixBech32Uint64Uint32Uint32Bech32(store sdk.KVStore, prefixBz []byte) error { - oldStore := prefix.NewStore(store, prefixBz) - - oldStoreIter := oldStore.Iterator(nil, nil) - defer func() { - _ = oldStoreIter.Close() - }() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - bech32Addr1 := string(oldStoreIter.Key()[:V014Bech32AddrLen]) - addr1, err := sdk.AccAddressFromBech32(bech32Addr1) - if err != nil { - return err - } - - midBz := oldStoreIter.Key()[V014Bech32AddrLen : V014Bech32AddrLen+16] - - bech32Addr2 := string(oldStoreIter.Key()[V014Bech32AddrLen+16:]) - addr2, err := sdk.AccAddressFromBech32(bech32Addr2) - if err != nil { - return err - } - - newStoreKey := append(append(append(prefixBz, address.MustLengthPrefix(addr1)...), midBz...), address.MustLengthPrefix(addr2)...) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - oldStore.Delete(oldStoreIter.Key()) - } - - return nil -} - -func migrateLease(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var oldObj mv1beta1.Lease - cdc.MustUnmarshal(fromBz, &oldObj) - to := mv1beta2.Lease{ - LeaseID: mv1beta2.LeaseID{ - Owner: oldObj.LeaseID.Owner, - DSeq: oldObj.LeaseID.DSeq, - GSeq: oldObj.LeaseID.GSeq, - OSeq: oldObj.LeaseID.OSeq, - Provider: oldObj.LeaseID.Provider, - }, - State: mv1beta2.Lease_State(oldObj.State), - Price: sdk.NewDecCoinFromCoin(oldObj.Price), - CreatedAt: oldObj.CreatedAt, - ClosedOn: 0, // For leases created prior to this change never report the data - } - - return &to -} - -func migrateBid(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var oldObject mv1beta1.Bid - cdc.MustUnmarshal(fromBz, &oldObject) - - to := mv1beta2.Bid{ - BidID: mv1beta2.BidID{ - Owner: oldObject.BidID.Owner, - DSeq: oldObject.BidID.DSeq, - GSeq: oldObject.BidID.GSeq, - OSeq: oldObject.BidID.OSeq, - Provider: oldObject.BidID.Provider, - }, - State: mv1beta2.Bid_State(oldObject.State), - Price: sdk.NewDecCoinFromCoin(oldObject.Price), - CreatedAt: oldObject.CreatedAt, - } - - return &to -} - -func migrateOrder(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var oldObject mv1beta1.Order - cdc.MustUnmarshal(fromBz, &oldObject) - - to := mv1beta2.Order{ - OrderID: mv1beta2.OrderID{ - Owner: oldObject.OrderID.Owner, - DSeq: oldObject.OrderID.DSeq, - GSeq: oldObject.OrderID.GSeq, - OSeq: oldObject.OrderID.OSeq, - }, - State: mv1beta2.Order_State(oldObject.State), - Spec: dmigrate.GroupSpecFromV1Beta1(oldObject.Spec), - CreatedAt: oldObject.CreatedAt, - } - - return &to -} diff --git a/upgrades/software/v0.15.0/proto_compatibility_test.go b/upgrades/software/v0.15.0/proto_compatibility_test.go deleted file mode 100644 index b460078ca1..0000000000 --- a/upgrades/software/v0.15.0/proto_compatibility_test.go +++ /dev/null @@ -1,290 +0,0 @@ -package v0_15_0_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - dv1beta1 "github.com/akash-network/akash-api/go/node/deployment/v1beta1" - dv1beta2 "github.com/akash-network/akash-api/go/node/deployment/v1beta2" - ev1beta1 "github.com/akash-network/akash-api/go/node/escrow/v1beta1" - ev1beta2 "github.com/akash-network/akash-api/go/node/escrow/v1beta2" - mv1beta1 "github.com/akash-network/akash-api/go/node/market/v1beta1" - mv1beta2 "github.com/akash-network/akash-api/go/node/market/v1beta2" - types "github.com/akash-network/akash-api/go/node/types/v1beta1" - - "github.com/akash-network/node/app" -) - -var ( - cdc = app.MakeEncodingConfig().Marshaler.(codec.BinaryCodec) -) - -func TestDeployment_DeploymentProto_IsCompatible(t *testing.T) { - oldProto := dv1beta1.Deployment{ - DeploymentID: dv1beta1.DeploymentID{Owner: "A", DSeq: 1}, - State: dv1beta1.DeploymentActive, - Version: []byte{1, 2, 3, 4}, - CreatedAt: 5, - } - - expectedProto := dv1beta2.Deployment{ - DeploymentID: dv1beta2.DeploymentID{Owner: "A", DSeq: 1}, - State: dv1beta2.DeploymentActive, - Version: []byte{1, 2, 3, 4}, - CreatedAt: 5, - } - - var actualProto dv1beta2.Deployment - cdc.MustUnmarshal(cdc.MustMarshal(&oldProto), &actualProto) - require.Equal(t, expectedProto, actualProto) - require.Equal(t, cdc.MustMarshal(&oldProto), cdc.MustMarshal(&expectedProto)) -} - -func TestDeployment_GroupProto_IsNotCompatible(t *testing.T) { - oldProto := dv1beta1.Group{ - GroupID: dv1beta1.GroupID{ - Owner: "A", - DSeq: 1, - GSeq: 2, - }, - State: dv1beta1.GroupOpen, - GroupSpec: dv1beta1.GroupSpec{ - Name: "A", - Requirements: types.PlacementRequirements{ - SignedBy: types.SignedBy{ - AllOf: []string{"a"}, - AnyOf: []string{"a"}, - }, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Resources: []dv1beta1.Resource{{ - Resources: types.ResourceUnits{ - CPU: &types.CPU{ - Units: types.ResourceValue{Val: sdk.NewInt(1)}, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Memory: &types.Memory{ - Quantity: types.ResourceValue{Val: sdk.NewInt(1)}, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Storage: &types.Storage{ - Quantity: types.ResourceValue{Val: sdk.NewInt(1)}, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Endpoints: []types.Endpoint{{Kind: types.Endpoint_RANDOM_PORT}}, - }, - Count: 1, - Price: sdk.NewCoin("uakt", sdk.NewInt(1)), - }}, - }, - CreatedAt: 5, - } - - var actualProto dv1beta2.Group - require.Error(t, cdc.Unmarshal(cdc.MustMarshal(&oldProto), &actualProto)) // it doesn't unmarshal -} - -func TestEscrow_AccountProto_IsNotCompatible(t *testing.T) { - oldProto := ev1beta1.Account{ - ID: ev1beta1.AccountID{ - Scope: "a", - XID: "a", - }, - Owner: "a", - State: 1, - Balance: sdk.NewCoin("uakt", sdk.NewInt(1)), - Transferred: sdk.NewCoin("uakt", sdk.NewInt(1)), - SettledAt: 2, - } - - expectedProto := ev1beta2.Account{ - ID: ev1beta2.AccountID{ - Scope: "a", - XID: "a", - }, - Owner: "a", - State: 1, - Balance: sdk.NewDecCoin("uakt", sdk.NewInt(1)), - Transferred: sdk.NewDecCoin("uakt", sdk.NewInt(1)), - SettledAt: 2, - Depositor: "", - Funds: sdk.DecCoin{}, - } - - var actualProto ev1beta2.Account - cdc.MustUnmarshal(cdc.MustMarshal(&oldProto), &actualProto) // although it unmarshalls - require.NotEqual(t, expectedProto, actualProto) // but the result isn't equal - require.NotEqual(t, cdc.MustMarshal(&oldProto), cdc.MustMarshal(&expectedProto)) // neither is marshalled bytes -} - -func TestEscrow_PaymentProto_IsNotCompatible(t *testing.T) { - oldProto := ev1beta1.Payment{ - AccountID: ev1beta1.AccountID{ - Scope: "a", - XID: "a", - }, - PaymentID: "a", - Owner: "a", - State: 1, - Rate: sdk.NewCoin("uakt", sdk.NewInt(1)), - Balance: sdk.NewCoin("uakt", sdk.NewInt(1)), - Withdrawn: sdk.NewCoin("uakt", sdk.NewInt(1)), - } - - expectedProto := ev1beta2.FractionalPayment{ - AccountID: ev1beta2.AccountID{ - Scope: "a", - XID: "a", - }, - PaymentID: "a", - Owner: "a", - State: 1, - Rate: sdk.NewDecCoin("uakt", sdk.NewInt(1)), - Balance: sdk.NewDecCoin("uakt", sdk.NewInt(1)), - Withdrawn: sdk.NewCoin("uakt", sdk.NewInt(1)), - } - - var actualProto ev1beta2.FractionalPayment - cdc.MustUnmarshal(cdc.MustMarshal(&oldProto), &actualProto) // although it unmarshalls - require.NotEqual(t, expectedProto, actualProto) // but the result isn't equal - require.NotEqual(t, cdc.MustMarshal(&oldProto), cdc.MustMarshal(&expectedProto)) // neither is marshalled bytes -} - -func TestMarket_BidProto_IsNotCompatible(t *testing.T) { - oldProto := mv1beta1.Bid{ - BidID: mv1beta1.BidID{ - Owner: "a", - DSeq: 1, - GSeq: 2, - OSeq: 3, - Provider: "a", - }, - State: mv1beta1.BidActive, - Price: sdk.NewCoin("uakt", sdk.NewInt(1)), - CreatedAt: 1, - } - - expectedProto := mv1beta2.Bid{ - BidID: mv1beta2.BidID{ - Owner: "a", - DSeq: 1, - GSeq: 2, - OSeq: 3, - Provider: "a", - }, - State: mv1beta2.BidActive, - Price: sdk.NewDecCoin("uakt", sdk.NewInt(1)), - CreatedAt: 1, - } - - var actualProto mv1beta2.Bid - cdc.MustUnmarshal(cdc.MustMarshal(&oldProto), &actualProto) // although it unmarshalls - require.NotEqual(t, expectedProto, actualProto) // but the result isn't equal - require.NotEqual(t, cdc.MustMarshal(&oldProto), cdc.MustMarshal(&expectedProto)) // neither is marshalled bytes -} - -func TestMarket_LeaseProto_IsNotCompatible(t *testing.T) { - oldProto := mv1beta1.Lease{ - LeaseID: mv1beta1.LeaseID{ - Owner: "a", - DSeq: 1, - GSeq: 2, - OSeq: 3, - Provider: "a", - }, - State: mv1beta1.LeaseActive, - Price: sdk.NewCoin("uakt", sdk.NewInt(1)), - CreatedAt: 1, - } - - expectedProto := mv1beta2.Lease{ - LeaseID: mv1beta2.LeaseID{ - Owner: "a", - DSeq: 1, - GSeq: 2, - OSeq: 3, - Provider: "a", - }, - State: mv1beta2.LeaseActive, - Price: sdk.NewDecCoin("uakt", sdk.NewInt(1)), - CreatedAt: 1, - } - - var actualProto mv1beta2.Lease - cdc.MustUnmarshal(cdc.MustMarshal(&oldProto), &actualProto) // although it unmarshalls - require.NotEqual(t, expectedProto, actualProto) // but the result isn't equal - require.NotEqual(t, cdc.MustMarshal(&oldProto), cdc.MustMarshal(&expectedProto)) // neither is marshalled bytes -} - -func TestMarket_OrderProto_IsNotCompatible(t *testing.T) { - oldProto := mv1beta1.Order{ - OrderID: mv1beta1.OrderID{ - Owner: "a", - DSeq: 1, - GSeq: 2, - OSeq: 3, - }, - State: mv1beta1.OrderActive, - Spec: dv1beta1.GroupSpec{ - Name: "A", - Requirements: types.PlacementRequirements{ - SignedBy: types.SignedBy{ - AllOf: []string{"a"}, - AnyOf: []string{"a"}, - }, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Resources: []dv1beta1.Resource{{ - Resources: types.ResourceUnits{ - CPU: &types.CPU{ - Units: types.ResourceValue{Val: sdk.NewInt(1)}, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Memory: &types.Memory{ - Quantity: types.ResourceValue{Val: sdk.NewInt(1)}, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Storage: &types.Storage{ - Quantity: types.ResourceValue{Val: sdk.NewInt(1)}, - Attributes: types.Attributes{{ - Key: "a", - Value: "a", - }}, - }, - Endpoints: []types.Endpoint{{Kind: types.Endpoint_RANDOM_PORT}}, - }, - Count: 1, - Price: sdk.NewCoin("uakt", sdk.NewInt(1)), - }}, - }, - CreatedAt: 1, - } - - var actualProto mv1beta2.Order - require.Error(t, cdc.Unmarshal(cdc.MustMarshal(&oldProto), &actualProto)) // it doesn't unmarshal -} diff --git a/upgrades/software/v0.15.0/provider.go b/upgrades/software/v0.15.0/provider.go deleted file mode 100644 index e6f803c51d..0000000000 --- a/upgrades/software/v0.15.0/provider.go +++ /dev/null @@ -1,46 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type providerMigrations struct { - utypes.Migrator -} - -func newProviderMigration(m utypes.Migrator) utypes.Migration { - return providerMigrations{Migrator: m} -} - -func (m providerMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates provider from version 1 to 2. -func (m providerMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - // old key is of format: - // ownerAddrBytes (20 bytes) - // new key is of format - // ownerAddrLen (1 byte) || ownerAddrBytes - oldStoreIter := store.Iterator(nil, nil) - defer func() { - _ = oldStoreIter.Close() - }() - - for ; oldStoreIter.Valid(); oldStoreIter.Next() { - newStoreKey := address.MustLengthPrefix(oldStoreIter.Key()) - - // Set new key on store. Values don't change. - store.Set(newStoreKey, oldStoreIter.Value()) - store.Delete(oldStoreIter.Key()) - } - return nil -} diff --git a/upgrades/software/v0.15.0/upgrade.go b/upgrades/software/v0.15.0/upgrade.go deleted file mode 100644 index 90a1b6c7e7..0000000000 --- a/upgrades/software/v0.15.0/upgrade.go +++ /dev/null @@ -1,93 +0,0 @@ -// Package v0_15_0 -// nolint revive -package v0_15_0 - -import ( - inflationtypes "github.com/akash-network/akash-api/go/node/inflation/v1beta3" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/authz" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibcconnectiontypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types" - ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" - "github.com/tendermint/tendermint/libs/log" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" -) - -const ( - upgradeName = "akash_v0.15.0_cosmos_v0.44.x" -) - -type upgrade struct { - *apptypes.App - ibc *ibckeeper.Keeper -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(_ log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - } - - val, err := apptypes.FindStructField[*ibckeeper.Keeper](&app.Keepers.Cosmos, "IBC") - if err != nil { - return nil, err - } - - up.ibc = val - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - upgrades := &storetypes.StoreUpgrades{ - Added: []string{ - authz.ModuleName, - inflationtypes.ModuleName, - }, - } - - return upgrades -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, versionMap module.VersionMap) (module.VersionMap, error) { - // set max expected block time parameter. Replace the default with your expected value - up.ibc.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) - - // 1st-time running in-store migrations, using 1 as fromVersion to - // avoid running InitGenesis. - fromVM := map[string]uint64{ - "auth": 1, - "bank": 1, - "capability": 1, - "crisis": 1, - "distribution": 1, - "evidence": 1, - "gov": 1, - "mint": 1, - "params": 1, - "slashing": 1, - "staking": 1, - "upgrade": 1, - "vesting": 1, - "ibc": 1, - "genutil": 1, - "transfer": 1, - - // akash modules - "audit": 1, - "cert": 1, - "deployment": 1, - "escrow": 1, - "market": 1, - "provider": 1, - } - - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} diff --git a/upgrades/software/v0.18.0/init.go b/upgrades/software/v0.18.0/init.go deleted file mode 100644 index 5eef63ed6f..0000000000 --- a/upgrades/software/v0.18.0/init.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package v0_18_0 -// nolint revive -package v0_18_0 - -import ( - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(upgradeName, initUpgrade) -} diff --git a/upgrades/software/v0.18.0/upgrade.go b/upgrades/software/v0.18.0/upgrade.go deleted file mode 100644 index 172ec79da7..0000000000 --- a/upgrades/software/v0.18.0/upgrade.go +++ /dev/null @@ -1,79 +0,0 @@ -// Package v0_18_0 -// nolint revive -package v0_18_0 - -import ( - "fmt" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts" - icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" - "github.com/tendermint/tendermint/libs/log" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" -) - -const ( - upgradeName = "v0.18.0" -) - -type upgrade struct { - *apptypes.App -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(_ log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - } - - if _, exists := up.MM.Modules[icatypes.ModuleName]; !exists { - return nil, fmt.Errorf("module %s has not been initialized", icatypes.ModuleName) // nolint: goerr113 - } - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - upgrades := &storetypes.StoreUpgrades{ - Added: []string{ - icacontrollertypes.StoreKey, - icahosttypes.StoreKey, - }, - } - - return upgrades -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - fromVM[icatypes.ModuleName] = up.MM.Modules[icatypes.ModuleName].ConsensusVersion() - - // create ICS27 Controller submodule params - // enable the controller chain - controllerParams := icacontrollertypes.Params{ControllerEnabled: true} - - // create ICS27 Host submodule params - hostParams := icahosttypes.Params{ - // enable the host chain - HostEnabled: true, - // allowing the all messages - AllowMessages: []string{"*"}, - } - - ctx.Logger().Info("start to init interchainaccount module...") - // initialize ICS27 module - up.MM.Modules[icatypes.ModuleName].(ica.AppModule).InitModule(ctx, controllerParams, hostParams) - - ctx.Logger().Info("start to run module migrations...") - - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} diff --git a/upgrades/software/v0.20.0/init.go b/upgrades/software/v0.20.0/init.go deleted file mode 100644 index 4ed992e4a1..0000000000 --- a/upgrades/software/v0.20.0/init.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package v0_20_0 -// nolint revive -package v0_20_0 - -import ( - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(upgradeName, initUpgrade) -} diff --git a/upgrades/software/v0.20.0/upgrade.go b/upgrades/software/v0.20.0/upgrade.go deleted file mode 100644 index 5e92347e65..0000000000 --- a/upgrades/software/v0.20.0/upgrade.go +++ /dev/null @@ -1,58 +0,0 @@ -// Package v0_20_0 -// nolint revive -package v0_20_0 - -import ( - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" - "github.com/tendermint/tendermint/libs/log" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" -) - -const ( - upgradeName = "v0.20.0" -) - -type upgrade struct { - *apptypes.App -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(_ log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - } - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - upgrades := &storetypes.StoreUpgrades{ - Deleted: []string{ - icacontrollertypes.StoreKey, - icahosttypes.StoreKey, - }, - } - - return upgrades -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - ctx.Logger().Info("start to roll-back interchainaccount module...") - - delete(fromVM, icatypes.ModuleName) - - ctx.Logger().Info("start to run module migrations...") - - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} diff --git a/upgrades/software/v0.24.0/deployment.go b/upgrades/software/v0.24.0/deployment.go deleted file mode 100644 index e1b2b800d1..0000000000 --- a/upgrades/software/v0.24.0/deployment.go +++ /dev/null @@ -1,48 +0,0 @@ -// Package v0_24_0 -// nolint revive -package v0_24_0 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - dv1beta2 "github.com/akash-network/akash-api/go/node/deployment/v1beta2" - dmigrate "github.com/akash-network/akash-api/go/node/deployment/v1beta3/migrate" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type deploymentMigrations struct { - utypes.Migrator -} - -func newDeploymentMigration(m utypes.Migrator) utypes.Migration { - return deploymentMigrations{Migrator: m} -} - -func (m deploymentMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates deployment from version 2 to 3. -func (m deploymentMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - err := utypes.MigrateValue(store, m.Codec(), dv1beta2.GroupPrefix(), migrateDeploymentGroup) - - if err != nil { - return err - } - - return nil -} - -func migrateDeploymentGroup(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var from dv1beta2.Group - cdc.MustUnmarshal(fromBz, &from) - - to := dmigrate.GroupFromV1Beta2(from) - - return &to -} diff --git a/upgrades/software/v0.24.0/init.go b/upgrades/software/v0.24.0/init.go deleted file mode 100644 index 0b464e0469..0000000000 --- a/upgrades/software/v0.24.0/init.go +++ /dev/null @@ -1,17 +0,0 @@ -// Package v0_24_0 -// nolint revive -package v0_24_0 - -import ( - dv1beta3 "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - mv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" - - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(upgradeName, initUpgrade) - - utypes.RegisterMigration(dv1beta3.ModuleName, 2, newDeploymentMigration) - utypes.RegisterMigration(mv1beta3.ModuleName, 2, newMarketMigration) -} diff --git a/upgrades/software/v0.24.0/market.go b/upgrades/software/v0.24.0/market.go deleted file mode 100644 index 93dd3708f8..0000000000 --- a/upgrades/software/v0.24.0/market.go +++ /dev/null @@ -1,59 +0,0 @@ -// Package v0_24_0 -// nolint revive -package v0_24_0 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - dmigrate "github.com/akash-network/akash-api/go/node/deployment/v1beta3/migrate" - mv1beta2 "github.com/akash-network/akash-api/go/node/market/v1beta2" - mv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type marketMigrations struct { - utypes.Migrator -} - -func newMarketMigration(m utypes.Migrator) utypes.Migration { - return marketMigrations{Migrator: m} -} - -func (m marketMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates deployment from version 2 to 3. -func (m marketMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - err := utypes.MigrateValue(store, m.Codec(), mv1beta3.OrderPrefix(), migrateOrder) - - if err != nil { - return err - } - - return nil -} - -func migrateOrder(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var oldObject mv1beta2.Order - cdc.MustUnmarshal(fromBz, &oldObject) - - to := mv1beta3.Order{ - OrderID: mv1beta3.OrderID{ - Owner: oldObject.OrderID.Owner, - DSeq: oldObject.OrderID.DSeq, - GSeq: oldObject.OrderID.GSeq, - OSeq: oldObject.OrderID.OSeq, - }, - State: mv1beta3.Order_State(oldObject.State), - Spec: dmigrate.GroupSpecFromV1Beta2(oldObject.Spec), - CreatedAt: oldObject.CreatedAt, - } - - return &to -} diff --git a/upgrades/software/v0.24.0/upgrade.go b/upgrades/software/v0.24.0/upgrade.go deleted file mode 100644 index 810bb0bcd7..0000000000 --- a/upgrades/software/v0.24.0/upgrade.go +++ /dev/null @@ -1,220 +0,0 @@ -// Package v0_24_0 -// nolint revive -package v0_24_0 - -import ( - "fmt" - "time" - - "github.com/tendermint/tendermint/libs/log" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/feegrant" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - astakingtypes "github.com/akash-network/akash-api/go/node/staking/v1beta3" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" - agov "github.com/akash-network/node/x/gov" - astaking "github.com/akash-network/node/x/staking" - atake "github.com/akash-network/node/x/take" -) - -const ( - upgradeName = "v0.24.0" -) - -type upgrade struct { - *apptypes.App - log log.Logger -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(log log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - log: log.With(fmt.Sprintf("upgrade/%s", upgradeName)), - } - - if _, exists := up.MM.Modules[agov.ModuleName]; !exists { - return nil, fmt.Errorf( - "module %s has not been initialized", - agov.ModuleName, - ) // nolint: goerr113 - } - - if _, exists := up.MM.Modules[astaking.ModuleName]; !exists { - return nil, fmt.Errorf( - "module %s has not been initialized", - astaking.ModuleName, - ) // nolint: goerr113 - } - - if _, exists := up.MM.Modules[atake.ModuleName]; !exists { - return nil, fmt.Errorf( - "module %s has not been initialized", - atake.ModuleName, - ) // nolint: goerr113 - } - - if _, exists := up.MM.Modules[feegrant.ModuleName]; !exists { - return nil, fmt.Errorf( - "module %s has not been initialized", - feegrant.ModuleName, - ) // nolint: goerr113 - } - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - upgrades := &storetypes.StoreUpgrades{ - Added: []string{ - feegrant.StoreKey, - agov.StoreKey, - astaking.StoreKey, - atake.StoreKey, - }, - } - - return upgrades -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - // initializing akash staking module here so enforceMinValidatorCommission below can use params - ctx.Logger().Info("initializing parameters in astaking module...") - if err := up.Keepers.Akash.Staking.SetParams(ctx, astakingtypes.DefaultParams()); err != nil { - return nil, err - } - - if err := up.enforceMinValidatorCommission(ctx); err != nil { - return nil, err - } - - up.patchDanglingEscrowPayments(ctx) - - ctx.Logger().Info("starting module migrations...") - - // migrate to new deployment params schema - up.Keepers.Akash.Deployment.SetParams(ctx, dtypes.DefaultParams()) - - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} - -func (up *upgrade) enforceMinValidatorCommission(ctx sdk.Context) error { - minRate := up.Keepers.Akash.Staking.MinCommissionRate(ctx) - - validators := up.Keepers.Cosmos.Staking.GetAllValidators(ctx) - - for _, validator := range validators { - // update MaxRate if it is less than minimum required rate - if validator.Commission.MaxRate.LT(minRate) { - validator.Commission.MaxRate = minRate - } - - if validator.GetCommission().LT(minRate) { - up.log.Info( - fmt.Sprintf( - "validator's `%s` current commission is %s%% < %[3]s%%(min required). Force updating to %[3]s%%", - validator.OperatorAddress, - validator.Commission.Rate, - minRate, - ), - ) - // set max change rate temporarily to 100% - maxRateCh := validator.Commission.MaxChangeRate - validator.Commission.MaxChangeRate = sdk.NewDecWithPrec(1, 0) - if _, err := updateValidatorCommission(ctx, validator, minRate); err != nil { - return err - } - - validator.Commission.MaxChangeRate = maxRateCh - - up.Keepers.Cosmos.Staking.BeforeValidatorModified(ctx, validator.GetOperator()) - up.Keepers.Cosmos.Staking.SetValidator(ctx, validator) - } - } - - return nil -} - -// updateValidatorCommission use custom implementation of update commission, -// this prevents panic during upgrade if any of validators have changed their -// commission within 24h of upgrade height -func updateValidatorCommission( - ctx sdk.Context, - validator stakingtypes.Validator, - newRate sdk.Dec, -) (stakingtypes.Commission, error) { - commission := validator.Commission - blockTime := ctx.BlockHeader().Time - - if err := validateNewRate(commission, newRate, blockTime); err != nil { - return commission, err - } - - commission.Rate = newRate - commission.UpdateTime = blockTime - - return commission, nil -} - -// validateNewRate performs basic sanity validation checks of a new commission -// rate. If validation fails, an SDK error is returned. -func validateNewRate(commission stakingtypes.Commission, newRate sdk.Dec, _ time.Time) error { - switch { - case newRate.IsNegative(): - // new rate cannot be negative - return stakingtypes.ErrCommissionNegative - - case newRate.GT(commission.MaxRate): - // new rate cannot be greater than the max rate - return stakingtypes.ErrCommissionGTMaxRate - - case newRate.Sub(commission.Rate).GT(commission.MaxChangeRate): - // new rate % points change cannot be greater than the max change rate - return stakingtypes.ErrCommissionGTMaxChangeRate - } - - return nil -} - -func (up *upgrade) patchDanglingEscrowPayments(ctx sdk.Context) { - up.Keepers.Akash.Escrow.WithPayments(ctx, func(payment v1beta3.FractionalPayment) bool { - acc, _ := up.Keepers.Akash.Escrow.GetAccount(ctx, payment.AccountID) - if (payment.State == v1beta3.PaymentOpen && acc.State != v1beta3.AccountOpen) || - (payment.State == v1beta3.PaymentOverdrawn && acc.State != v1beta3.AccountOverdrawn) { - - up.log.Info( - fmt.Sprintf( - "payment id state `%s:%s` does not match account state `%s:%s`. forcing payment state to %[4]s", - payment.PaymentID, - payment.State, - acc.ID, - acc.State, - ), - ) - - switch acc.State { - case v1beta3.AccountOpen: - payment.State = v1beta3.PaymentOpen - case v1beta3.AccountClosed: - payment.State = v1beta3.PaymentClosed - case v1beta3.AccountOverdrawn: - payment.State = v1beta3.PaymentOverdrawn - } - } - - up.Keepers.Akash.Escrow.SavePayment(ctx, payment) - return true - }) -} diff --git a/upgrades/software/v0.26.0/init.go b/upgrades/software/v0.26.0/init.go deleted file mode 100644 index e1df58ebd3..0000000000 --- a/upgrades/software/v0.26.0/init.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package v0_26_0 -// nolint revive -package v0_26_0 - -import ( - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(UpgradeName, initUpgrade) -} diff --git a/upgrades/software/v0.26.0/upgrade.go b/upgrades/software/v0.26.0/upgrade.go deleted file mode 100644 index 78ac996eef..0000000000 --- a/upgrades/software/v0.26.0/upgrade.go +++ /dev/null @@ -1,206 +0,0 @@ -// Package v0_26_0 -// nolint revive -package v0_26_0 - -import ( - "fmt" - "reflect" - "time" - - "github.com/tendermint/tendermint/libs/log" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/authz" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - v1beta2dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta2" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" -) - -const ( - UpgradeName = "v0.26.0" -) - -type upgrade struct { - *apptypes.App - log log.Logger -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(log log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - log: log.With("module", fmt.Sprintf("upgrade/%s", UpgradeName)), - } - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - return &storetypes.StoreUpgrades{} -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - if err := up.enforceMinValidatorCommission(ctx); err != nil { - return nil, err - } - - if err := up.migrateDeploymentAuthz(ctx); err != nil { - return nil, err - } - - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} - -type grantBackup struct { - granter sdk.AccAddress - grantee sdk.AccAddress - grant authz.Grant -} - -func (up *upgrade) migrateDeploymentAuthz(ctx sdk.Context) error { - msgUrlOld := v1beta2dtypes.DepositDeploymentAuthorization{}.MsgTypeURL() - - grants := make([]grantBackup, 0, 10000) - - up.Keepers.Cosmos.Authz.IterateGrants(ctx, func(granterAddr sdk.AccAddress, granteeAddr sdk.AccAddress, grant authz.Grant) bool { - authorization := grant.GetAuthorization() - if authorization.MsgTypeURL() == msgUrlOld { - grants = append(grants, grantBackup{ - granter: granterAddr, - grantee: granteeAddr, - grant: grant, - }) - } - return false - }) - - expiredCnt := 0 - - for _, grant := range grants { - authzGen := grant.grant.GetAuthorization() - authzOld, valid := authzGen.(*v1beta2dtypes.DepositDeploymentAuthorization) - if !valid { - return fmt.Errorf("unexpected authorization type. expected (%s), actual (%s)", reflect.TypeOf(&v1beta2dtypes.DepositDeploymentAuthorization{}), reflect.TypeOf(authzGen)) - } - - err := up.Keepers.Cosmos.Authz.DeleteGrant(ctx, grant.grantee, grant.granter, msgUrlOld) - if err != nil { - return err - } - - // Save only grants that are still active at upgrade block - if grant.grant.Expiration.Before(ctx.BlockHeader().Time) { - expiredCnt++ - continue - } - - authzNew := dtypes.NewDepositDeploymentAuthorization(authzOld.SpendLimit) - - err = up.Keepers.Cosmos.Authz.SaveGrant(ctx, grant.grantee, grant.granter, authzNew, grant.grant.Expiration) - if err != nil { - return err - } - } - - up.log.Info("updated DepositDeploymentAuthorizations from v1beta2 to v1beta3", "total", len(grants), "expired", expiredCnt) - - return nil -} - -func (up *upgrade) enforceMinValidatorCommission(ctx sdk.Context) error { - minRate := up.Keepers.Akash.Staking.MinCommissionRate(ctx) - validators := up.Keepers.Cosmos.Staking.GetAllValidators(ctx) - - for _, validator := range validators { - if validator.Commission.MaxRate.LT(minRate) || validator.GetCommission().LT(minRate) { - // update MaxRate if it is less than minimum required rate - if validator.Commission.MaxRate.LT(minRate) { - up.log.Info(fmt.Sprintf("force updating validator commission MaxRate to %s", minRate), - "address", - validator.OperatorAddress, - "currentMaxRate", - validator.Commission.MaxRate, - ) - - validator.Commission.MaxRate = minRate - } - - if validator.GetCommission().LT(minRate) { - up.log.Info(fmt.Sprintf("force updating validator commission Rate to %s", minRate), - "address", - validator.OperatorAddress, - "currentRate", - validator.Commission.Rate, - ) - - // set max change rate temporarily to 100% - maxRateCh := validator.Commission.MaxChangeRate - validator.Commission.MaxChangeRate = sdk.NewDecWithPrec(1, 0) - - newCommission, err := updateValidatorCommission(ctx, validator, minRate) - if err != nil { - return err - } - - validator.Commission = newCommission - validator.Commission.MaxChangeRate = maxRateCh - } - - up.Keepers.Cosmos.Staking.BeforeValidatorModified(ctx, validator.GetOperator()) - up.Keepers.Cosmos.Staking.SetValidator(ctx, validator) - } - } - - return nil -} - -// updateValidatorCommission use custom implementation of update commission, -// this prevents panic during upgrade if any of validators have changed their -// commission within 24h of upgrade height -func updateValidatorCommission( - ctx sdk.Context, - validator stakingtypes.Validator, - newRate sdk.Dec, -) (stakingtypes.Commission, error) { - commission := validator.Commission - blockTime := ctx.BlockHeader().Time - - if err := validateNewRate(commission, newRate, blockTime); err != nil { - return commission, err - } - - commission.Rate = newRate - commission.UpdateTime = blockTime - - return commission, nil -} - -// validateNewRate performs basic sanity validation checks of a new commission -// rate. If validation fails, an SDK error is returned. -func validateNewRate(commission stakingtypes.Commission, newRate sdk.Dec, _ time.Time) error { - switch { - case newRate.IsNegative(): - // new rate cannot be negative - return stakingtypes.ErrCommissionNegative - - case newRate.GT(commission.MaxRate): - // new rate cannot be greater than the max rate - return stakingtypes.ErrCommissionGTMaxRate - - case newRate.Sub(commission.Rate).GT(commission.MaxChangeRate): - // new rate % points change cannot be greater than the max change rate - return stakingtypes.ErrCommissionGTMaxChangeRate - } - - return nil -} diff --git a/upgrades/software/v0.28.0/init.go b/upgrades/software/v0.28.0/init.go deleted file mode 100644 index 5a9247158e..0000000000 --- a/upgrades/software/v0.28.0/init.go +++ /dev/null @@ -1,14 +0,0 @@ -// Package v0_28_0 -// nolint revive -package v0_28_0 - -import ( - mv1beta4 "github.com/akash-network/akash-api/go/node/market/v1beta4" - - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(UpgradeName, initUpgrade) - utypes.RegisterMigration(mv1beta4.ModuleName, 3, newMarketMigration) -} diff --git a/upgrades/software/v0.28.0/market.go b/upgrades/software/v0.28.0/market.go deleted file mode 100644 index eab6909cc1..0000000000 --- a/upgrades/software/v0.28.0/market.go +++ /dev/null @@ -1,48 +0,0 @@ -// Package v0_28_0 -// nolint revive -package v0_28_0 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - mv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" - mmigrate "github.com/akash-network/akash-api/go/node/market/v1beta4/migrate" - - utypes "github.com/akash-network/node/upgrades/types" -) - -type marketMigrations struct { - utypes.Migrator -} - -func newMarketMigration(m utypes.Migrator) utypes.Migration { - return marketMigrations{Migrator: m} -} - -func (m marketMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates deployment from version 2 to 3. -func (m marketMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - - err := utypes.MigrateValue(store, m.Codec(), mv1beta3.BidPrefix(), migrateBid) - - if err != nil { - return err - } - - return nil -} - -func migrateBid(fromBz []byte, cdc codec.BinaryCodec) codec.ProtoMarshaler { - var oldObject mv1beta3.Bid - cdc.MustUnmarshal(fromBz, &oldObject) - - to := mmigrate.BidFromV1beta3(oldObject) - - return &to -} diff --git a/upgrades/software/v0.28.0/upgrade.go b/upgrades/software/v0.28.0/upgrade.go deleted file mode 100644 index fa26681e97..0000000000 --- a/upgrades/software/v0.28.0/upgrade.go +++ /dev/null @@ -1,47 +0,0 @@ -// Package v0_28_0 -// nolint revive -package v0_28_0 - -import ( - "fmt" - - "github.com/tendermint/tendermint/libs/log" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" -) - -const ( - UpgradeName = "v0.28.0" -) - -type upgrade struct { - *apptypes.App - log log.Logger -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(log log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - log: log.With("module", fmt.Sprintf("upgrade/%s", UpgradeName)), - } - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - return &storetypes.StoreUpgrades{} -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} diff --git a/upgrades/software/v0.30.0/init.go b/upgrades/software/v0.30.0/init.go deleted file mode 100644 index 74a2ea72b1..0000000000 --- a/upgrades/software/v0.30.0/init.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package v0_30_0 -// nolint revive -package v0_30_0 - -import ( - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(UpgradeName, initUpgrade) -} diff --git a/upgrades/software/v0.30.0/upgrade.go b/upgrades/software/v0.30.0/upgrade.go deleted file mode 100644 index cfefa26118..0000000000 --- a/upgrades/software/v0.30.0/upgrade.go +++ /dev/null @@ -1,47 +0,0 @@ -// Package v0_30_0 -// nolint revive -package v0_30_0 - -import ( - "fmt" - - "github.com/tendermint/tendermint/libs/log" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" -) - -const ( - UpgradeName = "v0.30.0" -) - -type upgrade struct { - *apptypes.App - log log.Logger -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(log log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - log: log.With("module", fmt.Sprintf("upgrade/%s", UpgradeName)), - } - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - return &storetypes.StoreUpgrades{} -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} diff --git a/upgrades/software/v0.32.0/init.go b/upgrades/software/v0.32.0/init.go deleted file mode 100644 index c92faed6f1..0000000000 --- a/upgrades/software/v0.32.0/init.go +++ /dev/null @@ -1,14 +0,0 @@ -// Package v0_32_0 -// nolint revive -package v0_32_0 - -import ( - mv1beta4 "github.com/akash-network/akash-api/go/node/market/v1beta4" - - utypes "github.com/akash-network/node/upgrades/types" -) - -func init() { - utypes.RegisterUpgrade(UpgradeName, initUpgrade) - utypes.RegisterMigration(mv1beta4.ModuleName, 4, newMarketMigration) -} diff --git a/upgrades/software/v0.32.0/market.go b/upgrades/software/v0.32.0/market.go deleted file mode 100644 index 66d8f92d21..0000000000 --- a/upgrades/software/v0.32.0/market.go +++ /dev/null @@ -1,39 +0,0 @@ -// Package v0_32_0 -// nolint revive -package v0_32_0 - -import ( - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/market/keeper/keys/v1beta4" -) - -type marketMigrations struct { - utypes.Migrator -} - -func newMarketMigration(m utypes.Migrator) utypes.Migration { - return marketMigrations{Migrator: m} -} - -func (m marketMigrations) GetHandler() sdkmodule.MigrationHandler { - return m.handler -} - -// handler migrates market from version 3 to 4. -func (m marketMigrations) handler(ctx sdk.Context) error { - store := ctx.KVStore(m.StoreKey()) - iter := sdk.KVStorePrefixIterator(store, types.LeasePrefix()) - defer iter.Close() - for ; iter.Valid(); iter.Next() { - var val types.Lease - m.Codec().MustUnmarshal(iter.Value(), &val) - - store.Delete(v1beta4.SecondaryLeaseKeyByProvider(val.LeaseID)) - } - - return nil -} diff --git a/upgrades/software/v0.32.0/upgrade.go b/upgrades/software/v0.32.0/upgrade.go deleted file mode 100644 index cf6326cd0e..0000000000 --- a/upgrades/software/v0.32.0/upgrade.go +++ /dev/null @@ -1,47 +0,0 @@ -// Package v0_32_0 -// nolint revive -package v0_32_0 - -import ( - "fmt" - - "github.com/tendermint/tendermint/libs/log" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" -) - -const ( - UpgradeName = "v0.32.0" -) - -type upgrade struct { - *apptypes.App - log log.Logger -} - -var _ utypes.IUpgrade = (*upgrade)(nil) - -func initUpgrade(log log.Logger, app *apptypes.App) (utypes.IUpgrade, error) { - up := &upgrade{ - App: app, - log: log.With("module", fmt.Sprintf("upgrade/%s", UpgradeName)), - } - - return up, nil -} - -func (up *upgrade) StoreLoader() *storetypes.StoreUpgrades { - return &storetypes.StoreUpgrades{} -} - -func (up *upgrade) UpgradeHandler() upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return up.MM.RunMigrations(ctx, up.Configurator, fromVM) - } -} diff --git a/upgrades/software/v0.34.0/init.go b/upgrades/software/v0.34.0/init.go index 85fac9c593..8df65b6ca6 100644 --- a/upgrades/software/v0.34.0/init.go +++ b/upgrades/software/v0.34.0/init.go @@ -3,7 +3,7 @@ package v0_34_0 import ( - utypes "github.com/akash-network/node/upgrades/types" + utypes "pkg.akt.dev/akashd/upgrades/types" ) func init() { diff --git a/upgrades/software/v0.34.0/upgrade.go b/upgrades/software/v0.34.0/upgrade.go index 1a20e1ad17..ee248b3aad 100644 --- a/upgrades/software/v0.34.0/upgrade.go +++ b/upgrades/software/v0.34.0/upgrade.go @@ -5,15 +5,15 @@ package v0_34_0 import ( "fmt" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" + apptypes "pkg.akt.dev/akashd/app/types" + utypes "pkg.akt.dev/akashd/upgrades/types" ) const ( diff --git a/upgrades/software/v0.36.0/init.go b/upgrades/software/v0.36.0/init.go index da505525a7..a9a0fb4882 100644 --- a/upgrades/software/v0.36.0/init.go +++ b/upgrades/software/v0.36.0/init.go @@ -3,7 +3,7 @@ package v0_36_0 import ( - utypes "github.com/akash-network/node/upgrades/types" + utypes "pkg.akt.dev/akashd/upgrades/types" ) func init() { diff --git a/upgrades/software/v0.36.0/upgrade.go b/upgrades/software/v0.36.0/upgrade.go index 7a342587da..36f2a405b4 100644 --- a/upgrades/software/v0.36.0/upgrade.go +++ b/upgrades/software/v0.36.0/upgrade.go @@ -12,8 +12,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - apptypes "github.com/akash-network/node/app/types" - utypes "github.com/akash-network/node/upgrades/types" + apptypes "pkg.akt.dev/akashd/app/types" + utypes "pkg.akt.dev/akashd/upgrades/types" ) const ( diff --git a/upgrades/types/types.go b/upgrades/types/types.go index fcfe53ea9c..db38f00f52 100644 --- a/upgrades/types/types.go +++ b/upgrades/types/types.go @@ -3,15 +3,15 @@ package types import ( "fmt" - "github.com/cosmos/cosmos-sdk/codec" - sdkmodule "github.com/cosmos/cosmos-sdk/types/module" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkmodule "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - apptypes "github.com/akash-network/node/app/types" + apptypes "pkg.akt.dev/akashd/app/types" ) var ( @@ -58,7 +58,7 @@ type IHeightPatch interface { } type Migrator interface { - StoreKey() sdk.StoreKey + StoreKey() storetypes.StoreKey Codec() codec.BinaryCodec } diff --git a/upgrades/upgrades.go b/upgrades/upgrades.go index 4595db5ae4..bcbc0a23ef 100644 --- a/upgrades/upgrades.go +++ b/upgrades/upgrades.go @@ -2,21 +2,7 @@ package upgrades import ( // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.36.0" + _ "pkg.akt.dev/akashd/upgrades/software/v0.36.0" // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.34.0" - // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.32.0" - // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.30.0" - // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.28.0" - // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.26.0" - // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.24.0" - // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.20.0" - // nolint: revive - _ "github.com/akash-network/node/upgrades/software/v0.15.0" + _ "pkg.akt.dev/akashd/upgrades/software/v0.34.0" ) diff --git a/upgrades/upgrades_test.go b/upgrades/upgrades_test.go index 1c4acb96f4..ed16860760 100644 --- a/upgrades/upgrades_test.go +++ b/upgrades/upgrades_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "golang.org/x/mod/semver" - utypes "github.com/akash-network/node/upgrades/types" + utypes "pkg.akt.dev/akashd/upgrades/types" ) func TestUpgradesName(t *testing.T) { diff --git a/util/cli/configs.go b/util/cli/configs.go index 60e76482ae..bfe3644d2a 100644 --- a/util/cli/configs.go +++ b/util/cli/configs.go @@ -9,12 +9,14 @@ import ( "strings" "time" + // "cosmossdk.io/log" + "github.com/rs/zerolog" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" - tmcfg "github.com/tendermint/tendermint/config" + tmcfg "github.com/cometbft/cometbft/config" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" @@ -109,7 +111,7 @@ func InterceptConfigsPreRunHandler( logger = logger.With().Timestamp().Logger() } - serverCtx.Logger = server.ZeroLogWrapper{Logger: logger} + // serverCtx.Logger = server.ZeroLogWrapper{Logger: logger} if err = bindFlags(cmd, serverCtx.Viper, envPrefixes); err != nil { return err diff --git a/util/cli/upgrade_info.go b/util/cli/upgrade_info.go index 5a6f98f2ed..519d0af5a4 100644 --- a/util/cli/upgrade_info.go +++ b/util/cli/upgrade_info.go @@ -9,7 +9,7 @@ import ( "os" "strings" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v62/github" "github.com/gregjones/httpcache" "golang.org/x/oauth2" ) @@ -73,14 +73,16 @@ func UpgradeInfoFromTag(ctx context.Context, tag string, pretty bool) (string, e return "", fmt.Errorf("invalid checksum format") } + link := fmt.Sprintf("%s/%s?checksum=sha256:%s", urlBase, tuple[1], tuple[0]) + switch tuple[1] { case "akash_linux_amd64.zip": - info.Binaries["linux/amd64"] = fmt.Sprintf("%s/%s?checksum=sha256:%s", urlBase, tuple[1], tuple[0]) + info.Binaries["linux/amd64"] = link case "akash_linux_arm64.zip": - info.Binaries["linux/arm64"] = fmt.Sprintf("%s/%s?checksum=sha256:%s", urlBase, tuple[1], tuple[0]) + info.Binaries["linux/arm64"] = link case "akash_darwin_all.zip": - info.Binaries["darwin/amd64"] = fmt.Sprintf("%s/%s?checksum=sha256:%s", urlBase, tuple[1], tuple[0]) - info.Binaries["darwin/arm64"] = fmt.Sprintf("%s/%s?checksum=sha256:%s", urlBase, tuple[1], tuple[0]) + info.Binaries["darwin/amd64"] = link + info.Binaries["darwin/arm64"] = link } } diff --git a/util/metrics/metrics.go b/util/metrics/metrics.go index 144f8a144e..5f3529f455 100644 --- a/util/metrics/metrics.go +++ b/util/metrics/metrics.go @@ -3,8 +3,8 @@ package metrics import ( "time" - "github.com/akash-network/node/util/runner" "github.com/prometheus/client_golang/prometheus" + "pkg.akt.dev/akashd/util/runner" ) const SuccessLabel = "success" diff --git a/util/partialord/internal/dag/dag.go b/util/partialord/internal/dag/dag.go new file mode 100644 index 0000000000..b81c350a9e --- /dev/null +++ b/util/partialord/internal/dag/dag.go @@ -0,0 +1,320 @@ +package dag + +import ( + "fmt" + "sort" +) + +// DAG struct maintains a directed acyclic graph, using adjacency lists to track edges. +type DAG struct { + // there is a directed edge from u -> v, if directedEdgeList[u][v] = 1 + // there is a directed edge from v -> u, if directedEdgeList[u][v] = -1 + directedEdgeList []map[int]int8 + nodeNameToId map[string]int + idToNodeNames map[int]string +} + +func NewDAG(nodes []string) DAG { + nodeNameToId := make(map[string]int, len(nodes)) + idToNodeNames := make(map[int]string, len(nodes)) + directedEdgeList := make([]map[int]int8, len(nodes)) + for i, node := range nodes { + nodeNameToId[node] = i + idToNodeNames[i] = node + directedEdgeList[i] = map[int]int8{} + } + if len(nodeNameToId) != len(nodes) { + panic("provided multiple nodes with the same name") + } + return DAG{ + directedEdgeList: directedEdgeList, + nodeNameToId: nodeNameToId, + idToNodeNames: idToNodeNames, + } +} + +// Copy returns a new dag struct that is a copy of the original dag. +// Edges can be mutated in the copy, without altering the original. +func (dag DAG) Copy() DAG { + directedEdgeList := make([]map[int]int8, len(dag.nodeNameToId)) + for i := 0; i < len(dag.nodeNameToId); i++ { + originalEdgeList := dag.directedEdgeList[i] + directedEdgeList[i] = make(map[int]int8, len(originalEdgeList)) + for k, v := range originalEdgeList { + directedEdgeList[i][k] = v + } + } + // we reuse nodeNameToId and idToNodeNames as these are fixed at dag creation. + return DAG{ + directedEdgeList: directedEdgeList, + nodeNameToId: dag.nodeNameToId, + idToNodeNames: dag.idToNodeNames, + } +} + +func (dag DAG) hasDirectedEdge(u, v int) bool { + uAdjacencyList := dag.directedEdgeList[u] + _, exists := uAdjacencyList[v] + return exists +} + +// addEdge adds a directed edge from u -> v. +func (dag *DAG) addEdge(u, v int) error { + if u == v { + return fmt.Errorf("can't make self-edge") + } + if dag.hasDirectedEdge(v, u) { + return fmt.Errorf("dag has conflicting edge") + } + dag.directedEdgeList[u][v] = 1 + dag.directedEdgeList[v][u] = -1 + return nil +} + +// replaceEdge adds a directed edge from u -> v. +// it removes any edge that may already exist between the two. +func (dag *DAG) replaceEdge(u, v int) error { + if u == v { + return fmt.Errorf("can't make self-edge") + } + + dag.directedEdgeList[u][v] = 1 + dag.directedEdgeList[v][u] = -1 + return nil +} + +// resetEdges deletes all edges directed to or from node `u` +func (dag *DAG) resetEdges(u int) { + edges := dag.directedEdgeList[u] + for v := range edges { + delete(dag.directedEdgeList[v], u) + } + dag.directedEdgeList[u] = map[int]int8{} +} + +// deleteEdge deletes edges between u and v. +func (dag *DAG) deleteEdge(u, v int) { + delete(dag.directedEdgeList[u], v) + delete(dag.directedEdgeList[v], u) +} + +// AddEdge checks if either edge between u and v exists and adds a directed edge from u -> v +func (dag *DAG) AddEdge(u, v string) error { + uIndex, uExists := dag.nodeNameToId[u] + vIndex, vExists := dag.nodeNameToId[v] + if !uExists || !vExists { + return fmt.Errorf("one of %s, %s does not exist in dag", u, v) + } + return dag.addEdge(uIndex, vIndex) +} + +// ReplaceEdge adds a directed edge from u -> v. +// it removes any edge that may already exist between the two. +func (dag *DAG) ReplaceEdge(u, v string) error { + uIndex, uExists := dag.nodeNameToId[u] + vIndex, vExists := dag.nodeNameToId[v] + if !uExists || !vExists { + return fmt.Errorf("one of %s, %s does not exist in dag", u, v) + } + return dag.replaceEdge(uIndex, vIndex) +} + +// AddFirstElements sets the provided elements to be first in all orderings. +// So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} +// then we are guaranteed that the total ordering will begin with {D, B, A} +func (dag *DAG) AddFirstElements(nodes ...string) error { + nodeIds, err := dag.namesToIds(nodes) + if err != nil { + return err + } + + return dag.addFirst(nodeIds) +} + +func (dag *DAG) addFirst(nodes []int) error { + nodeMap := map[int]bool{} + for i := 0; i < len(nodes); i++ { + nodeMap[nodes[i]] = true + } + // First we add an edge from nodes[-1] to every node in the graph aside from the provided first nodes. + // then we make nodes[-1] depend on nodes[-2], etc. + // We also clear all other edges from nodes[-2], to override previous settings. + lastOfFirstNodes := nodes[len(nodes)-1] + for i := 0; i < len(dag.nodeNameToId); i++ { + // skip any node in the 'first set' + _, inMap := nodeMap[i] + if inMap { + continue + } + // We make everything on `lastOfFirstNodes`, and therefore have an edge from `lastOfFirstNodes` to it + err := dag.replaceEdge(lastOfFirstNodes, i) + // can't happen by above check + if err != nil { + return err + } + } + + // Make nodes[i+1] depend on nodes[i] + for i := len(nodes) - 2; i >= 0; i-- { + dag.resetEdges(nodes[i]) + err := dag.replaceEdge(nodes[i], nodes[i+1]) + // can't happen by above check + if err != nil { + return err + } + } + return nil +} + +// AddLastElements sets the provided elements to be last in all orderings. +// So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} +// then we are guaranteed that the total ordering will end with {D, B, A} +func (dag *DAG) AddLastElements(nodes ...string) error { + nodeIds, err := dag.namesToIds(nodes) + if err != nil { + return err + } + + return dag.addLast(nodeIds) +} + +func (dag *DAG) addLast(nodes []int) error { + nodeMap := map[int]bool{} + for i := 0; i < len(nodes); i++ { + nodeMap[nodes[i]] = true + } + // First we add an edge from every node in the graph aside from the provided last nodes, to nodes[0] + // then we make nodes[1] depend on nodes[0], etc. + // We also clear all other edges from nodes[1], to override previous settings. + firstOfLastNodes := nodes[0] + for i := 0; i < len(dag.nodeNameToId); i++ { + // skip any node in the 'last set' + _, inMap := nodeMap[i] + if inMap { + continue + } + // We make `firstOfLastNodes` depend on every node, and therefore have an edge from each node to `firstOfLastNodes` + err := dag.replaceEdge(i, firstOfLastNodes) + // can't happen by above check + if err != nil { + return err + } + } + + // Make nodes[i] depend on nodes[i-1], and clear all other edges from nodes[i] + for i := 1; i < len(nodes); i++ { + dag.resetEdges(nodes[i]) + err := dag.replaceEdge(nodes[i-1], nodes[i]) + // can't happen by above check + if err != nil { + return err + } + } + return nil +} + +func (dag DAG) hasEdges() bool { + for _, m := range dag.directedEdgeList { + if len(m) > 0 { + return true + } + } + return false +} + +func (dag *DAG) namesToIds(names []string) ([]int, error) { + nodeIds := []int{} + for _, name := range names { + nodeIndex, nodeExists := dag.nodeNameToId[name] + if !nodeExists { + return []int{}, fmt.Errorf("%s does not exist in dag", name) + } + nodeIds = append(nodeIds, nodeIndex) + } + return nodeIds, nil +} + +func (dag DAG) idsToNames(ids []int) []string { + sortedNames := make([]string, 0, len(ids)) + for i := 0; i < len(dag.nodeNameToId); i++ { + id := ids[i] + sortedNames = append(sortedNames, dag.idToNodeNames[id]) + } + return sortedNames +} + +func (dag DAG) hasIncomingEdge(u int) bool { + adjacencyList := dag.directedEdgeList[u] + for _, v := range adjacencyList { + if v == -1 { + return true + } + } + return false +} + +// returns nodes with no incoming edges. +func (dag *DAG) topologicalTopLevelNodes() []int { + topLevelNodes := []int{} + + for i := 0; i < len(dag.nodeNameToId); i++ { + if !dag.hasIncomingEdge(i) { + topLevelNodes = append(topLevelNodes, i) + } + } + + return topLevelNodes +} + +// Returns a Topological Sort of the DAG, using Kahn's algorithm. +// https://en.wikipedia.org/wiki/Topological_sorting#Kahn's_algorithm +func (dag DAG) TopologicalSort() []string { + // G is the mutable graph we work on, which we remove edges from. + G := dag.Copy() + // L in pseudocode + sortedIDs := make([]int, 0, len(dag.nodeNameToId)) + topLevelNodes := dag.topologicalTopLevelNodes() + + // while len(topLevelNodes) != 0 + for { + if len(topLevelNodes) == 0 { + break + } + // pop a node `n`` off of topLevelNodes + n := topLevelNodes[0] + topLevelNodes = topLevelNodes[1:] + // add it to the sorted list + sortedIDs = append(sortedIDs, n) + nEdgeList := G.directedEdgeList[n] + + // normally we'd do map iteration, but because we need cross-machine determinism, + // we gather all the nodes M for which there is an edge n -> m, sort that list, + // and then iterate over it. + nodesM := make([]int, 0, len(nEdgeList)) + for m, direction := range nEdgeList { + if direction != 1 { + panic("dag: topological sort correctness error. " + + "Popped node n was expected to have no incoming edges") + } + nodesM = append(nodesM, m) + } + + sort.Ints(nodesM) + + for _, m := range nodesM { + // remove edge from n -> m + G.deleteEdge(n, m) + // if m has no incomingEdges, add to topLevelNodes + if !G.hasIncomingEdge(m) { + topLevelNodes = append(topLevelNodes, m) + } + } + } + + if G.hasEdges() { + fmt.Println(G) + panic("dag: invalid construction, attempted to topologically sort a tree that is not a dag. A cycle exists") + } + + return dag.idsToNames(sortedIDs) +} diff --git a/util/partialord/internal/dag/dag_test.go b/util/partialord/internal/dag/dag_test.go new file mode 100644 index 0000000000..3651d428bf --- /dev/null +++ b/util/partialord/internal/dag/dag_test.go @@ -0,0 +1,154 @@ +package dag_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "pkg.akt.dev/akashd/util/partialord/internal/dag" +) + +type edge struct { + start, end string +} + +func TestTopologicalSort(t *testing.T) { + // Tests that topological sort works for various inputs. + // We hardcode the satisfying solution in the tests, even though it suffices + // to check that the partial ordering is sufficient. (and that's the only guarantee given externally) + // This is to ensure we catch differences in order between changes, and across machines. + simpleNodes := []string{"dog", "cat", "banana", "apple"} + simpleNodesRev := []string{"apple", "banana", "cat", "dog"} + tests := []struct { + nodes []string + edges []edge + expectedTopologicalOrder []string + }{ + { + // alphabetical ordering of simple nodes + nodes: simpleNodes, + edges: []edge{{"banana", "apple"}, {"cat", "banana"}, {"dog", "cat"}}, + expectedTopologicalOrder: simpleNodes, + }, + { + // apple > dog + nodes: simpleNodes, + edges: []edge{{"apple", "dog"}}, + expectedTopologicalOrder: []string{"cat", "banana", "apple", "dog"}, + }, + { + // apple > everything + nodes: simpleNodes, + edges: []edge{{"apple", "banana"}, {"apple", "cat"}, {"apple", "dog"}}, + expectedTopologicalOrder: []string{"apple", "dog", "cat", "banana"}, + }, + { + // apple > everything, on list with reversed initial order + nodes: simpleNodesRev, + edges: []edge{{"apple", "banana"}, {"apple", "cat"}, {"apple", "dog"}}, + expectedTopologicalOrder: []string{"apple", "banana", "cat", "dog"}, + }, + } + for _, tc := range tests { + dag := dag.NewDAG(tc.nodes) + for _, edge := range tc.edges { + err := dag.AddEdge(edge.start, edge.end) + require.NoError(t, err) + } + order := dag.TopologicalSort() + require.Equal(t, tc.expectedTopologicalOrder, order) + } +} + +func TestAddFirst(t *testing.T) { + simpleNodes := []string{"frog", "elephant", "dog", "cat", "banana", "apple"} + tests := []struct { + nodes []string + first []string + replaceEdges []edge + expectedTopologicalOrder []string + }{ + { + nodes: simpleNodes, + first: []string{"frog"}, + replaceEdges: []edge{{"banana", "apple"}, {"cat", "banana"}, {"dog", "cat"}}, + expectedTopologicalOrder: simpleNodes, + }, + { + nodes: simpleNodes, + first: []string{"elephant"}, + replaceEdges: []edge{{"banana", "apple"}, {"apple", "frog"}, {"dog", "cat"}}, + expectedTopologicalOrder: []string{"elephant", "dog", "banana", "cat", "apple", "frog"}, + }, + { + nodes: simpleNodes, + first: []string{"elephant", "frog"}, + replaceEdges: []edge{}, + expectedTopologicalOrder: []string{"elephant", "frog", "dog", "cat", "banana", "apple"}, + }, + { + // add three items in first, if implemented incorrectly could cause a cycle + nodes: simpleNodes, + first: []string{"dog", "elephant", "frog"}, + replaceEdges: []edge{}, + expectedTopologicalOrder: []string{"dog", "elephant", "frog", "cat", "banana", "apple"}, + }, + } + for _, tc := range tests { + dag := dag.NewDAG(tc.nodes) + dag.AddFirstElements(tc.first...) + for _, edge := range tc.replaceEdges { + err := dag.ReplaceEdge(edge.start, edge.end) + require.NoError(t, err) + } + order := dag.TopologicalSort() + require.Equal(t, tc.expectedTopologicalOrder, order) + } +} + +func TestAddLast(t *testing.T) { + simpleNodes := []string{"frog", "elephant", "dog", "cat", "banana", "apple"} + tests := []struct { + nodes []string + last []string + replaceEdges []edge + expectedTopologicalOrder []string + }{ + { + // causes no order change + nodes: simpleNodes, + last: []string{"apple"}, + replaceEdges: []edge{{"banana", "apple"}, {"cat", "banana"}, {"dog", "cat"}}, + expectedTopologicalOrder: simpleNodes, + }, + { + nodes: simpleNodes, + last: []string{"elephant"}, + replaceEdges: []edge{{"banana", "apple"}, {"apple", "frog"}, {"dog", "cat"}}, + expectedTopologicalOrder: []string{"dog", "banana", "cat", "apple", "frog", "elephant"}, + }, + { + nodes: simpleNodes, + last: []string{"elephant", "frog"}, + replaceEdges: []edge{}, + expectedTopologicalOrder: []string{"dog", "cat", "banana", "apple", "elephant", "frog"}, + }, + { + // add three items in last, if implemented incorrectly could cause a cycle + nodes: simpleNodes, + last: []string{"dog", "elephant", "frog"}, + replaceEdges: []edge{}, + expectedTopologicalOrder: []string{"cat", "banana", "apple", "dog", "elephant", "frog"}, + }, + } + for _, tc := range tests { + dag := dag.NewDAG(tc.nodes) + dag.AddLastElements(tc.last...) + for _, edge := range tc.replaceEdges { + err := dag.ReplaceEdge(edge.start, edge.end) + require.NoError(t, err) + } + order := dag.TopologicalSort() + require.Equal(t, tc.expectedTopologicalOrder, order) + } +} diff --git a/util/partialord/internal/dag/module.go b/util/partialord/internal/dag/module.go new file mode 100644 index 0000000000..4b4bcd971c --- /dev/null +++ b/util/partialord/internal/dag/module.go @@ -0,0 +1,9 @@ +// Package dag implements a simple Directed Acyclical Graph (DAG) for deterministic topological sorts +// +// It should not be externally exposed, and is intended to be a very simple dag implementation +// utilizing adjacency lists to store edges. +// +// This package is intended to be used for small scales, where performance of the algorithms is not critical. +// (e.g. sub 10k entries) +// Thus none of the algorithms in here are benchmarked, and just have correctness checks. +package dag diff --git a/util/partialord/module.go b/util/partialord/module.go new file mode 100644 index 0000000000..771816b2f7 --- /dev/null +++ b/util/partialord/module.go @@ -0,0 +1,2 @@ +// Package partialord allows one to define partial orderings, and derive a total ordering +package partialord diff --git a/util/partialord/partialord.go b/util/partialord/partialord.go new file mode 100644 index 0000000000..900e3f0e22 --- /dev/null +++ b/util/partialord/partialord.go @@ -0,0 +1,97 @@ +package partialord + +import ( + "sort" + + "pkg.akt.dev/akashd/util/partialord/internal/dag" +) + +type PartialOrdering struct { + // underlying dag, the partial ordering is stored via a dag + // https://en.wikipedia.org/wiki/Topological_sorting#Relation_to_partial_orders + dag dag.DAG + // bools for sealing, to prevent repeated invocation of first or last methods. + firstSealed bool + lastSealed bool +} + +// NewPartialOrdering creates a new partial ordering over the set of provided elements. +func NewPartialOrdering(elements []string) PartialOrdering { + elementsCopy := make([]string, len(elements)) + copy(elementsCopy, elements) + sort.Strings(elementsCopy) + return PartialOrdering{ + dag: dag.NewDAG(elementsCopy), + firstSealed: false, + lastSealed: false, + } +} + +func handleDAGErr(err error) { + // all dag errors are logic errors that the intended users of this package should not make. + if err != nil { + panic(err) + } +} + +// After marks that A should come after B +func (ord *PartialOrdering) After(A string, B string) { + // Set that A depends on B / an edge from B -> A + err := ord.dag.AddEdge(B, A) + handleDAGErr(err) +} + +// After marks that A should come before B +func (ord *PartialOrdering) Before(A string, B string) { + // Set that B depends on A / an edge from A -> B + err := ord.dag.AddEdge(A, B) + handleDAGErr(err) +} + +// Sets elems to be the first elements in the ordering. +// So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} +// then we are guaranteed that the total ordering will begin with {D, B, A} +func (ord *PartialOrdering) FirstElements(elems ...string) { + if ord.firstSealed { + panic("FirstElements has already been called") + } + // We make every node in the dag have a dependency on elems[-1] + // then we change elems[-1] to depend on elems[-2], and so forth. + err := ord.dag.AddFirstElements(elems...) + handleDAGErr(err) + ord.firstSealed = true +} + +// Sets elems to be the last elements in the ordering. +// So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} +// then we are guaranteed that the total ordering will end with {D, B, A} +func (ord *PartialOrdering) LastElements(elems ...string) { + if ord.lastSealed { + panic("FirstElements has already been called") + } + // We make every node in the dag have a dependency on elems[0] + // then we make elems[1] depend on elems[0], and so forth. + err := ord.dag.AddLastElements(elems...) + handleDAGErr(err) + ord.lastSealed = true +} + +// Sequence sets a sequence of ordering constraints. +// So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} +// then we are guaranteed that the total ordering will have D comes before B comes before A. +// (They're may be elements interspersed, e.g. {D, C, E, B, A} is a valid ordering) +func (ord *PartialOrdering) Sequence(seq ...string) { + // We make every node in the sequence have a prior node + for i := 0; i < (len(seq) - 1); i++ { + err := ord.dag.AddEdge(seq[i], seq[i+1]) + handleDAGErr(err) + } +} + +// TotalOrdering returns a deterministically chosen total ordering that satisfies all specified +// partial ordering constraints. +// +// Panics if no total ordering exists. +func (ord *PartialOrdering) TotalOrdering() []string { + return ord.dag.TopologicalSort() +} diff --git a/util/partialord/partialord_test.go b/util/partialord/partialord_test.go new file mode 100644 index 0000000000..57c855647a --- /dev/null +++ b/util/partialord/partialord_test.go @@ -0,0 +1,74 @@ +package partialord_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "pkg.akt.dev/akashd/util/partialord" +) + +func TestAPI(t *testing.T) { + // begin block use case, we have a dozen modules, but only care about a couple orders. + // In practice this will be gotten from some API, e.g. app.AllModuleNames() + moduleNames := []string{ + "auth", "authz", "bank", "capabilities", + "staking", "distribution", "epochs", "mint", "upgrades", "wasm", "ibc", + "ibctransfers", + } + beginBlockOrd := partialord.NewPartialOrdering(moduleNames) + beginBlockOrd.FirstElements("upgrades", "epochs", "capabilities") + beginBlockOrd.After("ibctransfers", "ibc") + beginBlockOrd.Before("mint", "distribution") + // This is purely just to test last functionality, doesn't make sense in context + beginBlockOrd.LastElements("auth", "authz", "wasm") + + totalOrd := beginBlockOrd.TotalOrdering() + expTotalOrd := []string{ + "upgrades", "epochs", "capabilities", + "bank", "ibc", "mint", "staking", "ibctransfers", "distribution", + "auth", "authz", "wasm", + } + require.Equal(t, expTotalOrd, totalOrd) +} + +func TestNonStandardAPIOrder(t *testing.T) { + // This test uses direct ordering before First, and after Last + names := []string{"A", "B", "C", "D", "E", "F", "G"} + ord := partialord.NewPartialOrdering(names) + ord.After("A", "C") + ord.After("A", "D") + ord.After("E", "B") + // overrides the "A" after "C" & "A" after "D" constraints + ord.FirstElements("A", "B", "C") + expOrdering := []string{"A", "B", "C", "D", "E", "F", "G"} + require.Equal(t, expOrdering, ord.TotalOrdering()) + + ord.After("E", "D") + expOrdering = []string{"A", "B", "C", "D", "F", "G", "E"} + require.Equal(t, expOrdering, ord.TotalOrdering()) + + ord.LastElements("G") + ord.After("F", "E") + expOrdering = []string{"A", "B", "C", "D", "E", "F", "G"} + require.Equal(t, expOrdering, ord.TotalOrdering()) +} + +// This test ad-hocly tests combination of multiple sequences, first elements, and an After +// invocation. +func TestSequence(t *testing.T) { + // This test uses direct ordering before First, and after Last + names := []string{"A", "B", "C", "D", "E", "F", "G"} + ord := partialord.NewPartialOrdering(names) + // Make B A C a sequence + ord.Sequence("B", "A", "C") + // Make A G E a sub-sequence + ord.Sequence("A", "G", "E") + // make first elements D B F + ord.FirstElements("D", "B", "F") + // make C come after E + ord.After("C", "G") + + expOrdering := []string{"D", "B", "F", "A", "G", "C", "E"} + require.Equal(t, expOrdering, ord.TotalOrdering()) +} diff --git a/util/server/server.go b/util/server/server.go index fb8c51919b..1f756c5348 100644 --- a/util/server/server.go +++ b/util/server/server.go @@ -6,15 +6,13 @@ import ( "os" "path/filepath" + dbm "github.com/cometbft/cometbft-db" + tmcmd "github.com/cometbft/cometbft/cmd/cometbft/commands" + tmjson "github.com/cometbft/cometbft/libs/json" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" - tmjson "github.com/tendermint/tendermint/libs/json" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tm-db" - - tmcmd "github.com/tendermint/tendermint/cmd/cometbft/commands" sdkserver "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/types" @@ -23,8 +21,10 @@ import ( const ( // Tendermint full-node start flags - flagTraceStore = "trace-store" - flagToFile = "to-file" + flagTraceStore = "trace-store" + flagToFile = "to-file" + FlagModulesToExport = "modules-to-export" + FlagOutputDocument = "output-document" ) // Commands server commands @@ -63,8 +63,8 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com Use: "export", Short: "Export state to JSON", RunE: func(cmd *cobra.Command, args []string) error { - serverCtx := sdkserver.GetServerContextFromCmd(cmd) - config := serverCtx.Config + sctx := sdkserver.GetServerContextFromCmd(cmd) + config := sctx.Config homeDir, _ := cmd.Flags().GetString(flags.FlagHome) config.SetRoot(homeDir) @@ -73,7 +73,7 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com return err } - db, err := openDB(config.RootDir) + db, err := openDB(config.RootDir, sdkserver.GetAppDBBackend(sctx.Viper)) if err != nil { return err } @@ -119,13 +119,24 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com height, _ := cmd.Flags().GetInt64(sdkserver.FlagHeight) forZeroHeight, _ := cmd.Flags().GetBool(sdkserver.FlagForZeroHeight) jailAllowedAddrs, _ := cmd.Flags().GetStringSlice(sdkserver.FlagJailAllowedAddrs) + modulesToExport, _ := cmd.Flags().GetStringSlice(FlagModulesToExport) + + exported, err := appExporter( + sctx.Logger, + db, + traceWriter, + height, + forZeroHeight, + jailAllowedAddrs, + sctx.Viper, + modulesToExport, + ) - exported, err := appExporter(serverCtx.Logger, db, traceWriter, height, forZeroHeight, jailAllowedAddrs, serverCtx.Viper) if err != nil { return fmt.Errorf("error exporting state: %v", err) } - doc, err := tmtypes.GenesisDocFromFile(serverCtx.Config.GenesisFile()) + doc, err := tmtypes.GenesisDocFromFile(sctx.Config.GenesisFile()) if err != nil { return err } @@ -133,18 +144,17 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com doc.AppState = exported.AppState doc.Validators = exported.Validators doc.InitialHeight = exported.Height - doc.ConsensusParams = &tmproto.ConsensusParams{ - Block: tmproto.BlockParams{ - MaxBytes: exported.ConsensusParams.Block.MaxBytes, - MaxGas: exported.ConsensusParams.Block.MaxGas, - TimeIotaMs: doc.ConsensusParams.Block.TimeIotaMs, + doc.ConsensusParams = &tmtypes.ConsensusParams{ + Block: tmtypes.BlockParams{ + MaxBytes: exported.ConsensusParams.Block.MaxBytes, + MaxGas: exported.ConsensusParams.Block.MaxGas, }, - Evidence: tmproto.EvidenceParams{ + Evidence: tmtypes.EvidenceParams{ MaxAgeNumBlocks: exported.ConsensusParams.Evidence.MaxAgeNumBlocks, MaxAgeDuration: exported.ConsensusParams.Evidence.MaxAgeDuration, MaxBytes: exported.ConsensusParams.Evidence.MaxBytes, }, - Validator: tmproto.ValidatorParams{ + Validator: tmtypes.ValidatorParams{ PubKeyTypes: exported.ConsensusParams.Validator.PubKeyTypes, }, } @@ -175,9 +185,9 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com return cmd } -func openDB(rootDir string) (dbm.DB, error) { +func openDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) { dataDir := filepath.Join(rootDir, "data") - return sdk.NewLevelDB("application", dataDir) + return dbm.NewDB("application", backendType, dataDir) } func openTraceWriter(traceWriterFile string) (w io.Writer, err error) { diff --git a/util/wsutil/wsutil.go b/util/wsutil/wsutil.go index 1226867fd7..b06664d963 100644 --- a/util/wsutil/wsutil.go +++ b/util/wsutil/wsutil.go @@ -2,9 +2,10 @@ package wsutil import ( "bytes" - "github.com/gorilla/websocket" "io" "sync" + + "github.com/gorilla/websocket" ) // This type exposes the single method that this wrapper uses diff --git a/util/wsutil/wsutil_test.go b/util/wsutil/wsutil_test.go index 42eff5c8d7..1b5c1ea8f1 100644 --- a/util/wsutil/wsutil_test.go +++ b/util/wsutil/wsutil_test.go @@ -1,11 +1,12 @@ package wsutil import ( - "github.com/gorilla/websocket" - "github.com/stretchr/testify/require" "io" "sync" "testing" + + "github.com/gorilla/websocket" + "github.com/stretchr/testify/require" ) type dummyConnection struct { diff --git a/x/audit/alias.go b/x/audit/alias.go index e566c57275..c79f6a8afe 100644 --- a/x/audit/alias.go +++ b/x/audit/alias.go @@ -1,9 +1,9 @@ package audit import ( - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1beta3" - "github.com/akash-network/node/x/audit/keeper" + "pkg.akt.dev/akashd/x/audit/keeper" ) const ( diff --git a/x/audit/client/cli/query.go b/x/audit/client/cli/query.go index 5edc94b650..18d4baeb4f 100644 --- a/x/audit/client/cli/query.go +++ b/x/audit/client/cli/query.go @@ -8,9 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" - aclient "github.com/akash-network/node/client" + aclient "pkg.akt.dev/akashd/client" ) func GetQueryCmd() *cobra.Command { diff --git a/x/audit/client/cli/tx.go b/x/audit/client/cli/tx.go index 9fbdb243c7..3e2408f78e 100644 --- a/x/audit/client/cli/tx.go +++ b/x/audit/client/cli/tx.go @@ -4,19 +4,18 @@ import ( "fmt" "sort" - cltypes "github.com/akash-network/akash-api/go/node/client/types" "github.com/spf13/cobra" sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - akashtypes "github.com/akash-network/akash-api/go/node/types/v1beta3" - atypes "github.com/akash-network/akash-api/go/node/types/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" + cltypes "pkg.akt.dev/go/node/client/types" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" + attrtypes "pkg.akt.dev/go/node/types/attributes/v1" - aclient "github.com/akash-network/node/client" + aclient "pkg.akt.dev/akashd/client" ) // GetTxCmd returns the transaction commands for audit module @@ -183,12 +182,12 @@ func setCmdProviderFlags(cmd *cobra.Command) { // if no arguments were provided then query provider and sign all found // read from stdin uses trick to check if it's file descriptor is a pipe // which happens when some data is piped for example cat attr.yaml | akash ... -func readAttributes(cmd *cobra.Command, cctx sdkclient.Context, provider string, args []string) (akashtypes.Attributes, error) { - var attr akashtypes.Attributes +func readAttributes(cmd *cobra.Command, cctx sdkclient.Context, provider string, args []string) (attrtypes.Attributes, error) { + var attr attrtypes.Attributes if len(args) != 0 { for i := 0; i < len(args); i += 2 { - attr = append(attr, atypes.Attribute{ + attr = append(attr, attrtypes.Attribute{ Key: args[i], Value: args[i+1], }) @@ -225,7 +224,7 @@ func readKeys(args []string) ([]string, error) { return args, nil } -func checkAttributeDuplicates(attr akashtypes.Attributes) bool { +func checkAttributeDuplicates(attr attrtypes.Attributes) bool { keys := make(map[string]bool) for _, entry := range attr { diff --git a/x/audit/client/rest/rest.go b/x/audit/client/rest/rest.go deleted file mode 100644 index 83afbf38dd..0000000000 --- a/x/audit/client/rest/rest.go +++ /dev/null @@ -1,87 +0,0 @@ -package rest - -import ( - "fmt" - "net/http" - - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" - "github.com/gorilla/mux" - - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" - - "github.com/akash-network/node/x/audit/query" -) - -// RegisterRoutes registers all query routes -func RegisterRoutes(ctx client.Context, r *mux.Router, ns string) { - prefix := fmt.Sprintf("/%s/attributes", ns) - - // Get all signed - r.HandleFunc(fmt.Sprintf("/%s/list", prefix), listAllSignedHandler(ctx, ns)).Methods("GET") - r.HandleFunc(fmt.Sprintf("/%s/owner/{providerOwner}/list", prefix), listProviderAttributes(ctx, ns)).Methods("GET") - r.HandleFunc(fmt.Sprintf("/%s/auditor/{auditor}/{providerOwner}", prefix), listAuditorProviderAttributes(ctx, ns)).Methods("GET") -} - -func listAllSignedHandler(ctx client.Context, ns string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - res, err := query.NewRawClient(ctx, ns).AllProviders() - if err != nil { - rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") - return - } - rest.PostProcessResponse(w, ctx, res) - } -} - -func listProviderAttributes(ctx client.Context, ns string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - id, err := sdk.AccAddressFromBech32(mux.Vars(r)["providerOwner"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, "Invalid address") - return - } - - res, err := query.NewRawClient(ctx, ns).Provider(id) - if err != nil { - rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") - return - } - rest.PostProcessResponse(w, ctx, res) - } -} - -func listAuditorProviderAttributes(ctx client.Context, ns string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - auditor, err := sdk.AccAddressFromBech32(mux.Vars(r)["auditor"]) - if err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, "Invalid address") - return - } - - var res []byte - - if addr := mux.Vars(r)["providerOwner"]; addr == "list" { - res, err = query.NewRawClient(ctx, ns).Auditor(auditor) - } else { - var owner sdk.AccAddress - if owner, err = sdk.AccAddressFromBech32(addr); err != nil { - rest.WriteErrorResponse(w, http.StatusBadRequest, "Invalid address") - return - } - - res, err = query.NewRawClient(ctx, ns).ProviderID(types.ProviderID{ - Owner: owner, - Auditor: auditor, - }) - } - - if err != nil { - rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") - return - } - - rest.PostProcessResponse(w, ctx, res) - } -} diff --git a/x/audit/genesis.go b/x/audit/genesis.go index c477ba586f..13396086b0 100644 --- a/x/audit/genesis.go +++ b/x/audit/genesis.go @@ -3,13 +3,13 @@ package audit import ( "encoding/json" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/akash-network/node/x/audit/keeper" + types "pkg.akt.dev/go/node/audit/v1" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + "pkg.akt.dev/akashd/x/audit/keeper" ) // ValidateGenesis does validation check of the Genesis and returns error incase of failure diff --git a/x/audit/handler/handler.go b/x/audit/handler/handler.go index f064702478..16dfa8fc1d 100644 --- a/x/audit/handler/handler.go +++ b/x/audit/handler/handler.go @@ -4,9 +4,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" - "github.com/akash-network/node/x/audit/keeper" + "pkg.akt.dev/akashd/x/audit/keeper" ) // NewHandler returns a handler for "provider" type messages. diff --git a/x/audit/handler/handler_test.go b/x/audit/handler/handler_test.go index 96008766ec..f1de975ca5 100644 --- a/x/audit/handler/handler_test.go +++ b/x/audit/handler/handler_test.go @@ -5,19 +5,22 @@ import ( "sort" "testing" + "github.com/stretchr/testify/require" + + dbm "github.com/cometbft/cometbft-db" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdktestdata "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/x/audit/handler" - "github.com/akash-network/node/x/audit/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/x/audit/handler" + "pkg.akt.dev/akashd/x/audit/keeper" ) type testSuite struct { @@ -37,7 +40,7 @@ func setupTestSuite(t *testing.T) *testSuite { db := dbm.NewMemDB() suite.ms = store.NewCommitMultiStore(db) - suite.ms.MountStoreWithDB(aKey, sdk.StoreTypeIAVL, db) + suite.ms.MountStoreWithDB(aKey, storetypes.StoreTypeIAVL, db) err := suite.ms.LoadLatestVersion() require.NoError(t, err) diff --git a/x/audit/handler/msg_server.go b/x/audit/handler/msg_server.go index 157d3b8bc7..d3f6ec2568 100644 --- a/x/audit/handler/msg_server.go +++ b/x/audit/handler/msg_server.go @@ -5,9 +5,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" - "github.com/akash-network/node/x/audit/keeper" + "pkg.akt.dev/akashd/x/audit/keeper" ) type msgServer struct { diff --git a/x/audit/keeper/grpc_query.go b/x/audit/keeper/grpc_query.go index 51e68b237a..9011d462d6 100644 --- a/x/audit/keeper/grpc_query.go +++ b/x/audit/keeper/grpc_query.go @@ -3,12 +3,13 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkquery "github.com/cosmos/cosmos-sdk/types/query" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkquery "github.com/cosmos/cosmos-sdk/types/query" + + types "pkg.akt.dev/go/node/audit/v1" ) // Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper diff --git a/x/audit/keeper/grpc_query_test.go b/x/audit/keeper/grpc_query_test.go index fb0425b99d..17bfdd957b 100644 --- a/x/audit/keeper/grpc_query_test.go +++ b/x/audit/keeper/grpc_query_test.go @@ -10,11 +10,11 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" - "github.com/akash-network/node/app" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/x/audit/keeper" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/x/audit/keeper" ) type grpcTestSuite struct { diff --git a/x/audit/keeper/keeper.go b/x/audit/keeper/keeper.go index 15cf20908c..b002b9e874 100644 --- a/x/audit/keeper/keeper.go +++ b/x/audit/keeper/keeper.go @@ -4,20 +4,18 @@ import ( "sort" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" - - akashtypes "github.com/akash-network/akash-api/go/node/types/v1beta3" - atypes "github.com/akash-network/akash-api/go/node/types/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" + attrv1 "pkg.akt.dev/go/node/types/attributes/v1" ) // TODO: use interfaces for keepers, queriers type IKeeper interface { GetProviderByAuditor(ctx sdk.Context, id types.ProviderID) (types.Provider, bool) GetProviderAttributes(ctx sdk.Context, id sdk.Address) (types.Providers, bool) - CreateOrUpdateProviderAttributes(ctx sdk.Context, id types.ProviderID, attr akashtypes.Attributes) error + CreateOrUpdateProviderAttributes(ctx sdk.Context, id types.ProviderID, attr attrv1.Attributes) error DeleteProviderAttributes(ctx sdk.Context, id types.ProviderID, keys []string) error WithProviders(ctx sdk.Context, fn func(types.Provider) bool) WithProvider(ctx sdk.Context, id sdk.Address, fn func(types.Provider) bool) @@ -25,12 +23,12 @@ type IKeeper interface { // Keeper of the provider store type Keeper struct { - skey sdk.StoreKey + skey storetypes.StoreKey cdc codec.BinaryCodec } // NewKeeper creates and returns an instance for Market keeper -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey) Keeper { +func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey) Keeper { return Keeper{cdc: cdc, skey: skey} } @@ -40,7 +38,7 @@ func (k Keeper) Codec() codec.BinaryCodec { } // StoreKey returns store key -func (k Keeper) StoreKey() sdk.StoreKey { +func (k Keeper) StoreKey() storetypes.StoreKey { return k.skey } @@ -86,7 +84,7 @@ func (k Keeper) GetProviderAttributes(ctx sdk.Context, id sdk.Address) (types.Pr // CreateOrUpdateProviderAttributes update signed provider attributes. // creates new if key does not exist // if key exists, existing values for matching pairs will be replaced -func (k Keeper) CreateOrUpdateProviderAttributes(ctx sdk.Context, id types.ProviderID, attr akashtypes.Attributes) error { +func (k Keeper) CreateOrUpdateProviderAttributes(ctx sdk.Context, id types.ProviderID, attr attrv1.Attributes) error { store := ctx.KVStore(k.skey) key := providerKey(id) @@ -111,10 +109,10 @@ func (k Keeper) CreateOrUpdateProviderAttributes(ctx sdk.Context, id types.Provi kv[entry.Key] = entry.Value } - attr = akashtypes.Attributes{} + attr = attrv1.Attributes{} for ky, val := range kv { - attr = append(attr, atypes.Attribute{ + attr = append(attr, attrv1.Attribute{ Key: ky, Value: val, }) @@ -129,9 +127,15 @@ func (k Keeper) CreateOrUpdateProviderAttributes(ctx sdk.Context, id types.Provi store.Set(key, k.cdc.MustMarshal(&prov)) - ctx.EventManager().EmitEvent( - types.NewEventTrustedAuditorCreated(id.Owner, id.Auditor).ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &types.EventTrustedAuditorCreated{ + Owner: id.Owner.String(), + Auditor: id.Auditor.String(), + }, ) + if err != nil { + return err + } return nil } @@ -164,7 +168,7 @@ func (k Keeper) DeleteProviderAttributes(ctx sdk.Context, id types.ProviderID, k for _, entry := range keys { if _, exists := kv[entry]; !exists { - return sdkerrors.Wrapf(types.ErrAttributeNotFound, "trying to delete non-existing attribute \"%s\" for auditor/provider \"%s/%s\"", + return types.ErrAttributeNotFound.Wrapf("trying to delete non-existing attribute \"%s\" for auditor/provider \"%s/%s\"", entry, prov.Auditor, prov.Owner) @@ -173,10 +177,10 @@ func (k Keeper) DeleteProviderAttributes(ctx sdk.Context, id types.ProviderID, k delete(kv, entry) } - var attr akashtypes.Attributes + var attr attrv1.Attributes for ky, val := range kv { - attr = append(attr, atypes.Attribute{ + attr = append(attr, attrv1.Attribute{ Key: ky, Value: val, }) @@ -195,9 +199,15 @@ func (k Keeper) DeleteProviderAttributes(ctx sdk.Context, id types.ProviderID, k } } - ctx.EventManager().EmitEvent( - types.NewEventTrustedAuditorDeleted(id.Owner, id.Auditor).ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &types.EventTrustedAuditorDeleted{ + Owner: id.Owner.String(), + Auditor: id.Auditor.String(), + }, ) + if err != nil { + return err + } return nil } diff --git a/x/audit/keeper/keeper_test.go b/x/audit/keeper/keeper_test.go index 1d3fc2804c..efcced20c6 100644 --- a/x/audit/keeper/keeper_test.go +++ b/x/audit/keeper/keeper_test.go @@ -6,17 +6,20 @@ import ( "testing" "time" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/stretchr/testify/require" + + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/rand" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/rand" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/x/audit/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/x/audit/keeper" ) func TestProviderCreate(t *testing.T) { @@ -155,7 +158,7 @@ func setupKeeper(t testing.TB) (sdk.Context, keeper.Keeper) { key := sdk.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() ms := store.NewCommitMultiStore(db) - ms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db) + ms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) err := ms.LoadLatestVersion() require.NoError(t, err) ctx := sdk.NewContext(ms, tmproto.Header{Time: time.Unix(0, 0)}, false, testutil.Logger(t)) diff --git a/x/audit/keeper/key.go b/x/audit/keeper/key.go index 347961a7f9..7b224d3818 100644 --- a/x/audit/keeper/key.go +++ b/x/audit/keeper/key.go @@ -3,11 +3,10 @@ package keeper import ( "bytes" - "github.com/cosmos/cosmos-sdk/types/address" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1" ) func providerKey(id types.ProviderID) []byte { diff --git a/x/audit/module.go b/x/audit/module.go index 22b600be04..9d479c07bb 100644 --- a/x/audit/module.go +++ b/x/audit/module.go @@ -4,38 +4,34 @@ import ( "context" "encoding/json" "fmt" - "math/rand" - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - sim "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/gogo/protobuf/grpc" - - v1beta1types "github.com/akash-network/akash-api/go/node/audit/v1beta1" - v1beta2types "github.com/akash-network/akash-api/go/node/audit/v1beta2" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" - - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/audit/client/cli" - "github.com/akash-network/node/x/audit/client/rest" - "github.com/akash-network/node/x/audit/handler" - "github.com/akash-network/node/x/audit/keeper" - pkeeper "github.com/akash-network/node/x/provider/keeper" + "github.com/cosmos/gogoproto/grpc" + + // v1beta1types "pkg.akt.dev/go/node/audit/v1beta1" + // v1beta2types "pkg.akt.dev/go/node/audit/v1beta2" + types "pkg.akt.dev/go/node/audit/v1" + + // "pkg.akt.dev/akashd/x/audit/client/rest" + + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/x/audit/client/cli" + "pkg.akt.dev/akashd/x/audit/handler" + "pkg.akt.dev/akashd/x/audit/keeper" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModuleSimulation{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the provider module. @@ -56,8 +52,8 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { types.RegisterInterfaces(registry) - v1beta2types.RegisterInterfaces(registry) - v1beta1types.RegisterInterfaces(registry) + // v1beta2types.RegisterInterfaces(registry) + // v1beta1types.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the provider @@ -84,10 +80,10 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo return ValidateGenesis(&data) } -// RegisterRESTRoutes registers rest routes for this module -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(clientCtx, rtr, StoreKey) -} +// // RegisterRESTRoutes registers rest routes for this module +// func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +// rest.RegisterRoutes(clientCtx, rtr, StoreKey) +// } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the provider module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { @@ -142,25 +138,17 @@ func (AppModule) Name() string { // RegisterInvariants registers module invariants func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} -// Route returns the message routing key for the audit module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, handler.NewHandler(am.keeper)) -} - // QuerierRoute returns the audit module's querier route name. func (am AppModule) QuerierRoute() string { - return "" -} - -// LegacyQuerierHandler returns the sdk.Querier for audit module -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil + return types.QuerierRoute } // RegisterServices registers the module's services func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), handler.NewMsgServerImpl(am.keeper)) + querier := keeper.Querier{Keeper: am.keeper} + types.RegisterQueryServer(cfg.QueryServer(), querier) utypes.ModuleMigrations(ModuleName, am.keeper, func(name string, forVersion uint64, handler module.MigrationHandler) { @@ -205,46 +193,3 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (am AppModule) ConsensusVersion() uint64 { return utypes.ModuleVersion(ModuleName) } - -// ____________________________________________________________________________ - -// AppModuleSimulation implements an application simulation module for the audit module. -type AppModuleSimulation struct { - keeper keeper.Keeper - pkeeper pkeeper.Keeper -} - -// NewAppModuleSimulation creates a new AppModuleSimulation instance -func NewAppModuleSimulation(k keeper.Keeper, pkeeper pkeeper.Keeper) AppModuleSimulation { - return AppModuleSimulation{ - keeper: k, - pkeeper: pkeeper, - } -} - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the staking module. -func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { - // simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModuleSimulation) RandomizedParams(r *rand.Rand) []sim.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for staking module's types -func (AppModuleSimulation) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - -} - -// WeightedOperations returns the all the staking module operations with their respective weights. -func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation { - return nil -} diff --git a/x/audit/query/rawclient.go b/x/audit/query/rawclient.go index 215bb7a25b..4dd3d997c0 100644 --- a/x/audit/query/rawclient.go +++ b/x/audit/query/rawclient.go @@ -6,7 +6,7 @@ import ( sdkclient "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/audit/v1beta3" + types "pkg.akt.dev/go/node/audit/v1beta3" ) // RawClient interface diff --git a/x/cert/alias.go b/x/cert/alias.go index 13f0af11d3..db7647fdc2 100644 --- a/x/cert/alias.go +++ b/x/cert/alias.go @@ -1,9 +1,9 @@ package cert import ( - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - "github.com/akash-network/node/x/cert/keeper" + "pkg.akt.dev/akashd/x/cert/keeper" ) const ( diff --git a/x/cert/client/cli/grpc_rest_test.go b/x/cert/client/cli/grpc_rest_test.go index c63e22eec8..f3283fc76b 100644 --- a/x/cert/client/cli/grpc_rest_test.go +++ b/x/cert/client/cli/grpc_rest_test.go @@ -9,16 +9,16 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" - sdkrest "github.com/cosmos/cosmos-sdk/types/rest" + // sdkrest "github.com/cosmos/cosmos-sdk/types/rest" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/network" - atypes "github.com/akash-network/node/types" - ccli "github.com/akash-network/node/x/cert/client/cli" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/network" + atypes "pkg.akt.dev/akashd/types" + ccli "pkg.akt.dev/akashd/x/cert/client/cli" ) type GRPCRestTestSuite struct { diff --git a/x/cert/client/cli/query.go b/x/cert/client/cli/query.go index 991c52037b..706b1971fb 100644 --- a/x/cert/client/cli/query.go +++ b/x/cert/client/cli/query.go @@ -9,14 +9,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - aclient "github.com/akash-network/node/client" -) - -const ( - stateValid = "valid" - stateRevoked = "revoked" + aclient "pkg.akt.dev/akashd/client" ) func GetQueryCmd() *cobra.Command { @@ -83,7 +78,7 @@ func cmdGetCertificates() *cobra.Command { } if value := cmd.Flag("state").Value.String(); value != "" { - if value != stateValid && value != stateRevoked { + if val, exists := types.State_value[value]; !exists || types.State(val) == types.CertificateStateInvalid { return fmt.Errorf("invalid value of --state flag. expected valid|revoked") } diff --git a/x/cert/client/cli/test_helpers.go b/x/cert/client/cli/test_helpers.go index 84a577afef..d8412ca45e 100644 --- a/x/cert/client/cli/test_helpers.go +++ b/x/cert/client/cli/test_helpers.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" sdktest "github.com/cosmos/cosmos-sdk/testutil" - testutilcli "github.com/akash-network/node/testutil/cli" + testutilcli "pkg.akt.dev/akashd/testutil/cli" ) // TxGenerateServerExec is used for testing create server certificate tx diff --git a/x/cert/client/cli/tx.go b/x/cert/client/cli/tx.go index 3b31dae764..bd516b83d4 100644 --- a/x/cert/client/cli/tx.go +++ b/x/cert/client/cli/tx.go @@ -7,17 +7,17 @@ import ( "math/big" "time" - cltypes "github.com/akash-network/akash-api/go/node/client/types" sdkclient "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/spf13/viper" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" + cltypes "pkg.akt.dev/go/node/client/types" - aclient "github.com/akash-network/node/client" - certerrors "github.com/akash-network/node/x/cert/errors" - "github.com/akash-network/node/x/cert/utils" + aclient "pkg.akt.dev/akashd/client" + certerrors "pkg.akt.dev/akashd/x/cert/errors" + "pkg.akt.dev/akashd/x/cert/utils" ) const ( @@ -204,11 +204,11 @@ func doRevokeCmd(cmd *cobra.Command) error { serial = parsedCert.SerialNumber.String() } - params := &types.QueryCertificatesRequest{ + req := &types.QueryCertificatesRequest{ Filter: types.CertificateFilter{ Owner: fromAddress.String(), Serial: serial, - State: stateValid, + State: types.CertificateValid.String(), }, } @@ -224,7 +224,7 @@ func doRevokeCmd(cmd *cobra.Command) error { return err } - res, err := cl.Query().Certificates(cmd.Context(), params) + res, err := cl.Query().Certificates(cmd.Context(), req) if err != nil { return err } @@ -235,7 +235,7 @@ func doRevokeCmd(cmd *cobra.Command) error { } msg := &types.MsgRevokeCertificate{ - ID: types.CertificateID{ + ID: types.ID{ Owner: cctx.FromAddress.String(), Serial: serial, }, diff --git a/x/cert/client/cli/tx_cmd.go b/x/cert/client/cli/tx_cmd.go index d37898ac3e..fe509cccb3 100644 --- a/x/cert/client/cli/tx_cmd.go +++ b/x/cert/client/cli/tx_cmd.go @@ -10,10 +10,11 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/spf13/cobra" "github.com/spf13/viper" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" ) func cmdGenerate() *cobra.Command { diff --git a/x/cert/client/cli/tx_test.go b/x/cert/client/cli/tx_test.go index cc3e2ec00c..5f33e15e24 100644 --- a/x/cert/client/cli/tx_test.go +++ b/x/cert/client/cli/tx_test.go @@ -4,13 +4,13 @@ import ( "fmt" "testing" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/x/cert/client/cli" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/x/cert/client/cli" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - certerrors "github.com/akash-network/node/x/cert/errors" + certerrors "pkg.akt.dev/akashd/x/cert/errors" ) const testHost = "foobar.dev" diff --git a/x/cert/genesis.go b/x/cert/genesis.go index 9819415b63..c5bb22837b 100644 --- a/x/cert/genesis.go +++ b/x/cert/genesis.go @@ -4,13 +4,13 @@ import ( "encoding/json" "fmt" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/akash-network/node/x/cert/keeper" + "pkg.akt.dev/akashd/x/cert/keeper" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" ) // ValidateGenesis does validation check of the Genesis and returns error in case of failure diff --git a/x/cert/handler/handler.go b/x/cert/handler/handler.go index 49e6bf763e..57aa291de0 100644 --- a/x/cert/handler/handler.go +++ b/x/cert/handler/handler.go @@ -4,9 +4,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - "github.com/akash-network/node/x/cert/keeper" + "pkg.akt.dev/akashd/x/cert/keeper" ) // NewHandler returns a handler for "provider" type messages. @@ -23,6 +23,6 @@ func NewHandler(keeper keeper.Keeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) } - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized message type: %T", msg) + return nil, sdkerrors.ErrUnknownRequest.Wrapf("unrecognized message type: %T", msg) } } diff --git a/x/cert/handler/handler_test.go b/x/cert/handler/handler_test.go index 91883f5ae6..e297c1e154 100644 --- a/x/cert/handler/handler_test.go +++ b/x/cert/handler/handler_test.go @@ -4,19 +4,21 @@ import ( "errors" "testing" + dbm "github.com/cometbft/cometbft-db" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/store" sdktestdata "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/x/cert/handler" - "github.com/akash-network/node/x/cert/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/x/cert/handler" + "pkg.akt.dev/akashd/x/cert/keeper" ) type testSuite struct { @@ -36,7 +38,7 @@ func setupTestSuite(t *testing.T) *testSuite { db := dbm.NewMemDB() suite.ms = store.NewCommitMultiStore(db) - suite.ms.MountStoreWithDB(aKey, sdk.StoreTypeIAVL, db) + suite.ms.MountStoreWithDB(aKey, storetypes.StoreTypeIAVL, db) err := suite.ms.LoadLatestVersion() require.NoError(t, err) @@ -191,7 +193,7 @@ func TestCertHandlerRevoke(t *testing.T) { testutil.CertificateRequireEqualResponse(t, cert, resp, types.CertificateValid) msgRevoke := &types.MsgRevokeCertificate{ - ID: types.CertificateID{ + ID: types.ID{ Owner: owner.String(), Serial: cert.Serial.String(), }, @@ -238,7 +240,7 @@ func TestCertHandlerRevokeCreateRevoked(t *testing.T) { testutil.CertificateRequireEqualResponse(t, cert, resp, types.CertificateValid) msgRevoke := &types.MsgRevokeCertificate{ - ID: types.CertificateID{ + ID: types.ID{ Owner: owner.String(), Serial: cert.Serial.String(), }, @@ -283,7 +285,7 @@ func TestCertHandlerRevokeCreate(t *testing.T) { testutil.CertificateRequireEqualResponse(t, cert, resp, types.CertificateValid) msgRevoke := &types.MsgRevokeCertificate{ - ID: types.CertificateID{ + ID: types.ID{ Owner: owner.String(), Serial: cert.Serial.String(), }, diff --git a/x/cert/handler/msg_server.go b/x/cert/handler/msg_server.go index e3559d5e5c..52bdaa66b7 100644 --- a/x/cert/handler/msg_server.go +++ b/x/cert/handler/msg_server.go @@ -5,9 +5,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - "github.com/akash-network/node/x/cert/keeper" + "pkg.akt.dev/akashd/x/cert/keeper" ) type msgServer struct { diff --git a/x/cert/keeper/grpc_query.go b/x/cert/keeper/grpc_query.go index a310e53e03..550355fb59 100644 --- a/x/cert/keeper/grpc_query.go +++ b/x/cert/keeper/grpc_query.go @@ -4,13 +4,14 @@ import ( "context" "math/big" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" ) // Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper @@ -32,16 +33,7 @@ func (q querier) Certificates(c context.Context, req *types.QueryCertificatesReq ctx := sdk.UnwrapSDKContext(c) store := ctx.KVStore(q.skey) - state := types.CertificateStateInvalid - if req.Filter.State != "" { - vl, exists := types.Certificate_State_value[req.Filter.State] - - if !exists { - return nil, status.Error(codes.InvalidArgument, "invalid state value") - } - - state = types.Certificate_State(vl) - } + state := req.Filter.State if req.Filter.Owner != "" { var owner sdk.Address @@ -111,6 +103,6 @@ func (q querier) Certificates(c context.Context, req *types.QueryCertificatesReq }, nil } -func filterCertByState(state types.Certificate_State, cert types.Certificate_State) bool { +func filterCertByState(state types.State, cert types.State) bool { return (state == types.CertificateStateInvalid) || (cert == state) } diff --git a/x/cert/keeper/grpc_query_test.go b/x/cert/keeper/grpc_query_test.go index 560cb11722..dfb5c6e57f 100644 --- a/x/cert/keeper/grpc_query_test.go +++ b/x/cert/keeper/grpc_query_test.go @@ -10,11 +10,11 @@ import ( sdkquery "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - "github.com/akash-network/node/app" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/x/cert/keeper" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/x/cert/keeper" ) type grpcTestSuite struct { @@ -172,7 +172,7 @@ func TestCertGRPCQueryCertificates(t *testing.T) { func() { req = &types.QueryCertificatesRequest{ Filter: types.CertificateFilter{ - State: types.Certificate_State_name[int32(types.CertificateValid)], + State: types.CertificateValid.String(), }, Pagination: &sdkquery.PageRequest{ Limit: 10, diff --git a/x/cert/keeper/keeper.go b/x/cert/keeper/keeper.go index ed11117586..5b04256f22 100644 --- a/x/cert/keeper/keeper.go +++ b/x/cert/keeper/keeper.go @@ -2,34 +2,35 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" ) // Keeper of the provider store type Keeper interface { Querier() types.QueryServer Codec() codec.BinaryCodec - StoreKey() sdk.StoreKey + StoreKey() storetypes.StoreKey CreateCertificate(sdk.Context, sdk.Address, []byte, []byte) error RevokeCertificate(sdk.Context, types.CertID) error GetCertificateByID(ctx sdk.Context, id types.CertID) (types.CertificateResponse, bool) WithCertificates(ctx sdk.Context, fn func(certificate types.CertificateResponse) bool) - WithCertificatesState(ctx sdk.Context, state types.Certificate_State, fn func(certificate types.CertificateResponse) bool) + WithCertificatesState(ctx sdk.Context, state types.State, fn func(certificate types.CertificateResponse) bool) WithOwner(ctx sdk.Context, id sdk.Address, fn func(types.CertificateResponse) bool) - WithOwnerState(ctx sdk.Context, id sdk.Address, state types.Certificate_State, fn func(types.CertificateResponse) bool) + WithOwnerState(ctx sdk.Context, id sdk.Address, state types.State, fn func(types.CertificateResponse) bool) } type keeper struct { - skey sdk.StoreKey + skey storetypes.StoreKey cdc codec.BinaryCodec } var _ Keeper = (*keeper)(nil) // NewKeeper creates and returns an instance for Market keeper -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey) Keeper { +func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey) Keeper { return &keeper{cdc: cdc, skey: skey} } @@ -44,7 +45,7 @@ func (k keeper) Codec() codec.BinaryCodec { } // StoreKey returns store key -func (k keeper) StoreKey() sdk.StoreKey { +func (k keeper) StoreKey() storetypes.StoreKey { return k.skey } @@ -135,7 +136,7 @@ func (k keeper) WithCertificates(ctx sdk.Context, fn func(certificate types.Cert } // WithCertificatesState iterates all certificates in certain state -func (k keeper) WithCertificatesState(ctx sdk.Context, state types.Certificate_State, fn func(certificate types.CertificateResponse) bool) { +func (k keeper) WithCertificatesState(ctx sdk.Context, state types.State, fn func(certificate types.CertificateResponse) bool) { store := ctx.KVStore(k.skey) iter := store.Iterator(nil, nil) @@ -170,7 +171,7 @@ func (k keeper) WithOwner(ctx sdk.Context, id sdk.Address, fn func(types.Certifi } // WithOwnerState iterates all certificates by owner in certain state -func (k keeper) WithOwnerState(ctx sdk.Context, id sdk.Address, state types.Certificate_State, fn func(types.CertificateResponse) bool) { +func (k keeper) WithOwnerState(ctx sdk.Context, id sdk.Address, state types.State, fn func(types.CertificateResponse) bool) { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, certificatePrefix(id)) defer func() { diff --git a/x/cert/keeper/keeper_test.go b/x/cert/keeper/keeper_test.go index bb8084d69f..2f8be3a8a8 100644 --- a/x/cert/keeper/keeper_test.go +++ b/x/cert/keeper/keeper_test.go @@ -4,16 +4,19 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + + dbm "github.com/cometbft/cometbft-db" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/x/cert/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/x/cert/keeper" ) func TestCertKeeperCreate(t *testing.T) { @@ -193,7 +196,7 @@ func setupKeeper(t testing.TB) (sdk.Context, keeper.Keeper) { key := sdk.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() ms := store.NewCommitMultiStore(db) - ms.MountStoreWithDB(key, sdk.StoreTypeIAVL, db) + ms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) err := ms.LoadLatestVersion() require.NoError(t, err) ctx := sdk.NewContext(ms, tmproto.Header{Time: time.Unix(0, 0)}, false, testutil.Logger(t)) diff --git a/x/cert/keeper/key.go b/x/cert/keeper/key.go index dae2b02a14..a295a9fc31 100644 --- a/x/cert/keeper/key.go +++ b/x/cert/keeper/key.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1" ) const ( diff --git a/x/cert/module.go b/x/cert/module.go index f731232051..d5b17d9700 100644 --- a/x/cert/module.go +++ b/x/cert/module.go @@ -4,35 +4,30 @@ import ( "context" "encoding/json" "fmt" - "math/rand" - - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - sim "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/spf13/cobra" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/tendermint/tendermint/abci/types" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" - "github.com/akash-network/akash-api/go/node/cert/v1beta1" - "github.com/akash-network/akash-api/go/node/cert/v1beta2" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/cert/client/cli" - "github.com/akash-network/node/x/cert/handler" - "github.com/akash-network/node/x/cert/keeper" - "github.com/akash-network/node/x/cert/simulation" + types "pkg.akt.dev/go/node/cert/v1" + + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/x/cert/client/cli" + "pkg.akt.dev/akashd/x/cert/handler" + "pkg.akt.dev/akashd/x/cert/keeper" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModuleSimulation{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the provider module. @@ -53,8 +48,6 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { types.RegisterInterfaces(registry) - v1beta2.RegisterInterfaces(registry) - v1beta1.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the provider @@ -129,21 +122,11 @@ func (AppModule) Name() string { // RegisterInvariants registers module invariants func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// Route returns the message routing key for the audit module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, handler.NewHandler(am.keeper)) -} - // QuerierRoute returns the audit module's querier route name. func (am AppModule) QuerierRoute() string { return "" } -// LegacyQuerierHandler returns the sdk.Querier for audit module -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers the module's services func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), handler.NewMsgServerImpl(am.keeper)) @@ -184,44 +167,3 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (am AppModule) ConsensusVersion() uint64 { return utypes.ModuleVersion(ModuleName) } - -// ____________________________________________________________________________ - -// AppModuleSimulation implements an application simulation module for the audit module. -type AppModuleSimulation struct { - keeper keeper.Keeper -} - -// NewAppModuleSimulation creates a new AppModuleSimulation instance -func NewAppModuleSimulation(k keeper.Keeper) AppModuleSimulation { - return AppModuleSimulation{ - keeper: k, - } -} - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the staking module. -func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModuleSimulation) RandomizedParams(_ *rand.Rand) []sim.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for staking module's types -func (AppModuleSimulation) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { - -} - -// WeightedOperations returns the all the staking module operations with their respective weights. -func (am AppModuleSimulation) WeightedOperations(_ module.SimulationState) []sim.WeightedOperation { - return nil -} diff --git a/x/cert/simulation/genesis.go b/x/cert/simulation/genesis.go index 35937b336d..92e5cdc0b9 100644 --- a/x/cert/simulation/genesis.go +++ b/x/cert/simulation/genesis.go @@ -3,7 +3,7 @@ package simulation import ( "github.com/cosmos/cosmos-sdk/types/module" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" + types "pkg.akt.dev/go/node/cert/v1beta3" ) func RandomizedGenState(simState *module.SimulationState) { diff --git a/x/cert/utils/key_pair_manager.go b/x/cert/utils/key_pair_manager.go index 3b9e070f77..05c5f03de4 100644 --- a/x/cert/utils/key_pair_manager.go +++ b/x/cert/utils/key_pair_manager.go @@ -19,11 +19,12 @@ import ( "go.step.sm/crypto/pemutil" - types "github.com/akash-network/akash-api/go/node/cert/v1beta3" sdkclient "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" - certerrors "github.com/akash-network/node/x/cert/errors" + types "pkg.akt.dev/go/node/cert/v1" + + certerrors "pkg.akt.dev/akashd/x/cert/errors" ) var ( diff --git a/x/cert/utils/utils.go b/x/cert/utils/utils.go index 21653c9e4c..043a9128c8 100644 --- a/x/cert/utils/utils.go +++ b/x/cert/utils/utils.go @@ -7,11 +7,11 @@ import ( "io" "time" - certerrors "github.com/akash-network/node/x/cert/errors" + certerrors "pkg.akt.dev/akashd/x/cert/errors" "github.com/cosmos/cosmos-sdk/client" - ctypes "github.com/akash-network/akash-api/go/node/cert/v1beta3" + ctypes "pkg.akt.dev/go/node/cert/v1beta3" ) // LoadAndQueryCertificateForAccount wraps LoadAndQueryPEMForAccount and tls.X509KeyPair diff --git a/x/deployment/alias.go b/x/deployment/alias.go index ad74d2dd8e..f9a24c13c7 100644 --- a/x/deployment/alias.go +++ b/x/deployment/alias.go @@ -1,9 +1,9 @@ package deployment import ( - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + types "pkg.akt.dev/go/node/deployment/v1" - "github.com/akash-network/node/x/deployment/keeper" + "pkg.akt.dev/akashd/x/deployment/keeper" ) const ( diff --git a/x/deployment/client/cli/cli_test.go b/x/deployment/client/cli/cli_test.go index 71f46544a5..90064618e4 100644 --- a/x/deployment/client/cli/cli_test.go +++ b/x/deployment/client/cli/cli_test.go @@ -8,27 +8,33 @@ import ( "github.com/stretchr/testify/suite" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" - banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + dv1 "pkg.akt.dev/go/node/deployment/v1" + dv1beta4 "pkg.akt.dev/go/node/deployment/v1beta4" + types "pkg.akt.dev/go/node/deployment/v1beta4" + + "pkg.akt.dev/go/cli" - "github.com/akash-network/node/testutil" - clitestutil "github.com/akash-network/node/testutil/cli" - "github.com/akash-network/node/testutil/network" - ccli "github.com/akash-network/node/x/cert/client/cli" - "github.com/akash-network/node/x/deployment/client/cli" + "pkg.akt.dev/akashd/testutil" + clitestutil "pkg.akt.dev/akashd/testutil/cli" + "pkg.akt.dev/akashd/testutil/network" + ccli "pkg.akt.dev/akashd/x/cert/client/cli" + dcli "pkg.akt.dev/akashd/x/deployment/client/cli" ) type IntegrationTestSuite struct { suite.Suite cfg network.Config network *network.Network - keyFunder keyring.Info + keyFunder *keyring.Record defaultDeposit sdk.Coin } @@ -55,16 +61,19 @@ func (s *IntegrationTestSuite) SetupSuite() { s.keyFunder, err = val.ClientCtx.Keyring.Key("keyFoo") s.Require().NoError(err) - s.defaultDeposit, err = types.DefaultParams().MinDepositFor("uakt") + addrFunder, err := s.keyFunder.GetAddress() + s.Require().Error(err) + + s.defaultDeposit, err = dv1beta4.DefaultParams().MinDepositFor("uakt") s.Require().NoError(err) - res, err := banktestutil.MsgSendExec( + res, err := sdktestutil.MsgSendExec( val.ClientCtx, val.Address, - s.keyFunder.GetAddress(), + addrFunder, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, s.defaultDeposit.Amount.MulRaw(4))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -85,8 +94,8 @@ func (s *IntegrationTestSuite) SetupSuite() { context.Background(), val.ClientCtx, val.Address, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -109,34 +118,34 @@ func (s *IntegrationTestSuite) TestDeployment() { s.Require().NoError(err) // create deployment - _, err = cli.TxCreateDeploymentExec( + _, err = dcli.TxCreateDeploymentExec( val.ClientCtx, val.Address, deploymentPath, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--deposit=%s", cli.DefaultDeposit), + fmt.Sprintf("--deposit=%s", dcli.DefaultDeposit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // test query deployments - resp, err := cli.QueryDeploymentsExec(val.ClientCtx.WithOutputFormat("json")) + resp, err := dcli.QueryDeploymentsExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) - out := &types.QueryDeploymentsResponse{} + out := &dv1beta4.QueryDeploymentsResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), out) s.Require().NoError(err) s.Require().Len(out.Deployments, 1, "Deployment Create Failed") deployments := out.Deployments - s.Require().Equal(val.Address.String(), deployments[0].Deployment.DeploymentID.Owner) + s.Require().Equal(val.Address.String(), deployments[0].Deployment.ID.Owner) // test query deployment createdDep := deployments[0] - resp, err = cli.QueryDeploymentExec(val.ClientCtx.WithOutputFormat("json"), createdDep.Deployment.DeploymentID) + resp, err = dcli.QueryDeploymentExec(val.ClientCtx.WithOutputFormat("json"), createdDep.Deployment.ID) s.Require().NoError(err) var deployment types.QueryDeploymentResponse @@ -145,26 +154,26 @@ func (s *IntegrationTestSuite) TestDeployment() { s.Require().Equal(createdDep, deployment) // test query deployments with filters - resp, err = cli.QueryDeploymentsExec( + resp, err = dcli.QueryDeploymentsExec( val.ClientCtx.WithOutputFormat("json"), fmt.Sprintf("--owner=%s", val.Address.String()), - fmt.Sprintf("--dseq=%v", createdDep.Deployment.DeploymentID.DSeq), + fmt.Sprintf("--dseq=%v", createdDep.Deployment.ID.DSeq), ) s.Require().NoError(err, "Error when fetching deployments with owner filter") - out = &types.QueryDeploymentsResponse{} + out = &dv1beta4.QueryDeploymentsResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), out) s.Require().NoError(err) s.Require().Len(out.Deployments, 1) // test updating deployment - _, err = cli.TxUpdateDeploymentExec( + _, err = dcli.TxUpdateDeploymentExec( val.ClientCtx, val.Address, deploymentPath2, - fmt.Sprintf("--dseq=%v", createdDep.Deployment.DeploymentID.DSeq), + fmt.Sprintf("--dseq=%v", createdDep.Deployment.ID.DSeq), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -172,50 +181,50 @@ func (s *IntegrationTestSuite) TestDeployment() { s.Require().NoError(s.network.WaitForNextBlock()) - resp, err = cli.QueryDeploymentExec(val.ClientCtx.WithOutputFormat("json"), createdDep.Deployment.DeploymentID) + resp, err = dcli.QueryDeploymentExec(val.ClientCtx.WithOutputFormat("json"), createdDep.Deployment.ID) s.Require().NoError(err) var deploymentV2 types.QueryDeploymentResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &deploymentV2) s.Require().NoError(err) - s.Require().NotEqual(deployment.Deployment.Version, deploymentV2.Deployment.Version) + s.Require().NotEqual(deployment.Deployment.Hash, deploymentV2.Deployment.Hash) // test query deployments with wrong owner value - _, err = cli.QueryDeploymentsExec( + _, err = dcli.QueryDeploymentsExec( val.ClientCtx.WithOutputFormat("json"), "--owner=cosmos102ruvpv2srmunfffxavttxnhezln6fnc3pf7tt", ) s.Require().Error(err) // test query deployments with wrong state value - _, err = cli.QueryDeploymentsExec( + _, err = dcli.QueryDeploymentsExec( val.ClientCtx.WithOutputFormat("json"), "--state=hello", ) s.Require().Error(err) // test close deployment - _, err = cli.TxCloseDeploymentExec( + _, err = dcli.TxCloseDeploymentExec( val.ClientCtx, val.Address, - fmt.Sprintf("--dseq=%v", createdDep.Deployment.DeploymentID.DSeq), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--dseq=%v", createdDep.Deployment.ID.DSeq), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // test query deployments with state filter closed - resp, err = cli.QueryDeploymentsExec( + resp, err = dcli.QueryDeploymentsExec( val.ClientCtx.WithOutputFormat("json"), "--state=closed", ) s.Require().NoError(err) - out = &types.QueryDeploymentsResponse{} + out = &dv1beta4.QueryDeploymentsResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), out) s.Require().NoError(err) s.Require().Len(out.Deployments, 1, "Deployment Close Failed") @@ -228,52 +237,52 @@ func (s *IntegrationTestSuite) TestGroup() { s.Require().NoError(err) // create deployment - _, err = cli.TxCreateDeploymentExec( + _, err = dcli.TxCreateDeploymentExec( val.ClientCtx, val.Address, deploymentPath, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--deposit=%s", cli.DefaultDeposit), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), + fmt.Sprintf("--deposit=%s", dcli.DefaultDeposit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // test query deployments - resp, err := cli.QueryDeploymentsExec( + resp, err := dcli.QueryDeploymentsExec( val.ClientCtx.WithOutputFormat("json"), "--state=active", ) s.Require().NoError(err) - out := &types.QueryDeploymentsResponse{} + out := &dv1beta4.QueryDeploymentsResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), out) s.Require().NoError(err) s.Require().Len(out.Deployments, 1, "Deployment Create Failed") deployments := out.Deployments - s.Require().Equal(val.Address.String(), deployments[0].Deployment.DeploymentID.Owner) + s.Require().Equal(val.Address.String(), deployments[0].Deployment.ID.Owner) createdDep := deployments[0] s.Require().NotEqual(0, len(createdDep.Groups)) // test close group tx - _, err = cli.TxCloseGroupExec( + _, err = dcli.TxCloseGroupExec( val.ClientCtx, - createdDep.Groups[0].GroupID, + createdDep.Groups[0].ID, val.Address, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) - resp, err = cli.QueryGroupExec(val.ClientCtx.WithOutputFormat("json"), createdDep.Groups[0].GroupID) + resp, err = dcli.QueryGroupExec(val.ClientCtx.WithOutputFormat("json"), createdDep.Groups[0].ID) s.Require().NoError(err) var group types.Group @@ -288,64 +297,67 @@ func (s *IntegrationTestSuite) TestFundedDeployment() { deploymentPath, err := filepath.Abs("../../testdata/deployment-v2.yaml") s.Require().NoError(err) - deploymentID := types.DeploymentID{ + deploymentID := dv1.DeploymentID{ Owner: val.Address.String(), DSeq: uint64(105), } - prevFunderBal := s.getAccountBalance(s.keyFunder.GetAddress()) + addrFunder, err := s.keyFunder.GetAddress() + s.Require().Error(err) + + prevFunderBal := s.getAccountBalance(addrFunder) // Creating deployment paid by funder's account without any authorization from funder should fail - _, err = cli.TxCreateDeploymentExec( + _, err = dcli.TxCreateDeploymentExec( val.ClientCtx, val.Address, deploymentPath, - fmt.Sprintf("--%s", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), + fmt.Sprintf("--%s", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), fmt.Sprintf("--dseq=%v", deploymentID.DSeq), - fmt.Sprintf("--depositor-account=%s", s.keyFunder.GetAddress().String()), + fmt.Sprintf("--depositor-account=%s", addrFunder.String()), ) s.Require().Error(err) // funder's balance shouldn't be deducted - s.Require().Equal(prevFunderBal, s.getAccountBalance(s.keyFunder.GetAddress())) + s.Require().Equal(prevFunderBal, s.getAccountBalance(addrFunder)) // Grant the tenant authorization to use funds from the funder's account - res, err := cli.TxGrantAuthorizationExec( + res, err := dcli.TxGrantAuthorizationExec( val.ClientCtx, - s.keyFunder.GetAddress(), + addrFunder, val.Address, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) clitestutil.ValidateTxSuccessful(s.T(), val.ClientCtx, res.Bytes()) - prevFunderBal = s.getAccountBalance(s.keyFunder.GetAddress()) + prevFunderBal = s.getAccountBalance(addrFunder) ownerBal := s.getAccountBalance(val.Address) // Creating deployment paid by funder's account should work now - res, err = cli.TxCreateDeploymentExec( + res, err = dcli.TxCreateDeploymentExec( val.ClientCtx, val.Address, deploymentPath, - fmt.Sprintf("--%s", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), fmt.Sprintf("--dseq=%v", deploymentID.DSeq), - fmt.Sprintf("--depositor-account=%s", s.keyFunder.GetAddress().String()), + fmt.Sprintf("--depositor-account=%s", addrFunder.String()), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) clitestutil.ValidateTxSuccessful(s.T(), val.ClientCtx, res.Bytes()) // funder's balance should be deducted correctly - curFunderBal := s.getAccountBalance(s.keyFunder.GetAddress()) + curFunderBal := s.getAccountBalance(addrFunder) s.Require().Equal(prevFunderBal.Sub(s.defaultDeposit.Amount), curFunderBal) prevFunderBal = curFunderBal @@ -355,14 +367,14 @@ func (s *IntegrationTestSuite) TestFundedDeployment() { ownerBal = curOwnerBal // depositing additional funds from the owner's account should work - res, err = cli.TxDepositDeploymentExec( + res, err = dcli.TxDepositDeploymentExec( val.ClientCtx, s.defaultDeposit, val.Address, - fmt.Sprintf("--%s", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), fmt.Sprintf("--dseq=%v", deploymentID.DSeq), ) s.Require().NoError(err) @@ -376,75 +388,76 @@ func (s *IntegrationTestSuite) TestFundedDeployment() { ownerBal = curOwnerBal // depositing additional funds from the funder's account should work - res, err = cli.TxDepositDeploymentExec( + res, err = dcli.TxDepositDeploymentExec( val.ClientCtx, s.defaultDeposit, val.Address, - fmt.Sprintf("--%s", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), fmt.Sprintf("--dseq=%v", deploymentID.DSeq), - fmt.Sprintf("--depositor-account=%s", s.keyFunder.GetAddress().String()), + fmt.Sprintf("--depositor-account=%s", addrFunder.String()), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) clitestutil.ValidateTxSuccessful(s.T(), val.ClientCtx, res.Bytes()) // funder's balance should be deducted correctly - curFunderBal = s.getAccountBalance(s.keyFunder.GetAddress()) + curFunderBal = s.getAccountBalance(addrFunder) s.Require().Equal(prevFunderBal.Sub(s.defaultDeposit.Amount), curFunderBal) prevFunderBal = curFunderBal // revoke the authorization given to the deployment owner by the funder - res, err = cli.TxRevokeAuthorizationExec( + res, err = dcli.TxRevokeAuthorizationExec( val.ClientCtx, - s.keyFunder.GetAddress(), + addrFunder, val.Address, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) clitestutil.ValidateTxSuccessful(s.T(), val.ClientCtx, res.Bytes()) - prevFunderBal = s.getAccountBalance(s.keyFunder.GetAddress()) + + prevFunderBal = s.getAccountBalance(addrFunder) // depositing additional funds from the funder's account should fail now - _, err = cli.TxDepositDeploymentExec( + _, err = dcli.TxDepositDeploymentExec( val.ClientCtx, s.defaultDeposit, val.Address, - fmt.Sprintf("--%s", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), fmt.Sprintf("--dseq=%v", deploymentID.DSeq), - fmt.Sprintf("--depositor-account=%s", s.keyFunder.GetAddress().String()), + fmt.Sprintf("--depositor-account=%s", addrFunder.String()), ) s.Require().Error(err) // funder's balance shouldn't be deducted - s.Require().Equal(prevFunderBal, s.getAccountBalance(s.keyFunder.GetAddress())) + s.Require().Equal(prevFunderBal, s.getAccountBalance(addrFunder)) ownerBal = s.getAccountBalance(val.Address) // closing the deployment should return the funds and balance in escrow to the funder and // owner's account - res, err = cli.TxCloseDeploymentExec( + res, err = dcli.TxCloseDeploymentExec( val.ClientCtx, val.Address, - fmt.Sprintf("--%s", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(20))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), fmt.Sprintf("--dseq=%v", deploymentID.DSeq), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) clitestutil.ValidateTxSuccessful(s.T(), val.ClientCtx, res.Bytes()) - s.Require().Equal(prevFunderBal.Add(s.defaultDeposit.Amount.MulRaw(2)), s.getAccountBalance(s.keyFunder.GetAddress())) + s.Require().Equal(prevFunderBal.Add(s.defaultDeposit.Amount.MulRaw(2)), s.getAccountBalance(addrFunder)) s.Require().Equal(ownerBal.Add(s.defaultDeposit.Amount).SubRaw(20), s.getAccountBalance(val.Address)) } @@ -452,9 +465,9 @@ func TestIntegrationTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) } -func (s *IntegrationTestSuite) getAccountBalance(address sdk.AccAddress) sdk.Int { +func (s *IntegrationTestSuite) getAccountBalance(address sdk.AccAddress) sdkmath.Int { cctxJSON := s.network.Validators[0].ClientCtx.WithOutputFormat("json") - res, err := banktestutil.QueryBalancesExec(cctxJSON, address) + res, err := sdktestutil.QueryBalancesExec(cctxJSON, address) s.Require().NoError(err) var balRes banktypes.QueryAllBalancesResponse err = cctxJSON.Codec.UnmarshalJSON(res.Bytes(), &balRes) diff --git a/x/deployment/client/cli/flags.go b/x/deployment/client/cli/flags.go index 5715318189..991466f51d 100644 --- a/x/deployment/client/cli/flags.go +++ b/x/deployment/client/cli/flags.go @@ -4,11 +4,13 @@ import ( "errors" "strings" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/spf13/pflag" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + sdk "github.com/cosmos/cosmos-sdk/types" + + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" ) const ( @@ -18,7 +20,7 @@ const ( var ( ErrStateValue = errors.New("query: invalid state value") - DefaultDeposit, _ = types.DefaultParams().MinDepositFor("uakt") + DefaultDeposit, _ = v1beta4.DefaultParams().MinDepositFor("uakt") ) type DeploymentIDOptions struct { @@ -84,8 +86,8 @@ func MarkReqDeploymentIDFlags(cmd *cobra.Command, opts ...DeploymentIDOption) { } // DeploymentIDFromFlags returns DeploymentID with given flags, owner and error if occurred -func DeploymentIDFromFlags(flags *pflag.FlagSet, opts ...MarketOption) (types.DeploymentID, error) { - var id types.DeploymentID +func DeploymentIDFromFlags(flags *pflag.FlagSet, opts ...MarketOption) (v1.DeploymentID, error) { + var id v1.DeploymentID opt := &MarketOptions{} for _, o := range opts { @@ -115,8 +117,8 @@ func DeploymentIDFromFlags(flags *pflag.FlagSet, opts ...MarketOption) (types.De } // DeploymentIDFromFlagsForOwner returns DeploymentID with given flags, owner and error if occurred -func DeploymentIDFromFlagsForOwner(flags *pflag.FlagSet, owner sdk.Address) (types.DeploymentID, error) { - id := types.DeploymentID{ +func DeploymentIDFromFlagsForOwner(flags *pflag.FlagSet, owner sdk.Address) (v1.DeploymentID, error) { + id := v1.DeploymentID{ Owner: owner.String(), } @@ -140,8 +142,8 @@ func MarkReqGroupIDFlags(cmd *cobra.Command, opts ...DeploymentIDOption) { } // GroupIDFromFlags returns GroupID with given flags and error if occurred -func GroupIDFromFlags(flags *pflag.FlagSet, opts ...MarketOption) (types.GroupID, error) { - var id types.GroupID +func GroupIDFromFlags(flags *pflag.FlagSet, opts ...MarketOption) (v1.GroupID, error) { + var id v1.GroupID prev, err := DeploymentIDFromFlags(flags, opts...) if err != nil { return id, err @@ -151,7 +153,7 @@ func GroupIDFromFlags(flags *pflag.FlagSet, opts ...MarketOption) (types.GroupID if err != nil { return id, err } - return types.MakeGroupID(prev, gseq), nil + return v1.MakeGroupID(prev, gseq), nil } // AddDeploymentFilterFlags add flags to filter for deployment list @@ -162,8 +164,8 @@ func AddDeploymentFilterFlags(flags *pflag.FlagSet) { } // DepFiltersFromFlags returns DeploymentFilters with given flags and error if occurred -func DepFiltersFromFlags(flags *pflag.FlagSet) (types.DeploymentFilters, error) { - var dfilters types.DeploymentFilters +func DepFiltersFromFlags(flags *pflag.FlagSet) (v1beta4.DeploymentFilters, error) { + var dfilters v1beta4.DeploymentFilters owner, err := flags.GetString("owner") if err != nil { return dfilters, err diff --git a/x/deployment/client/cli/grpc_rest_test.go b/x/deployment/client/cli/grpc_rest_test.go index 4a23e0602f..09e36c15b7 100644 --- a/x/deployment/client/cli/grpc_rest_test.go +++ b/x/deployment/client/cli/grpc_rest_test.go @@ -8,17 +8,19 @@ import ( "github.com/stretchr/testify/suite" - "github.com/cosmos/cosmos-sdk/client/flags" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" - sdkrest "github.com/cosmos/cosmos-sdk/types/rest" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + v1 "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/network" - atypes "github.com/akash-network/node/types" - ccli "github.com/akash-network/node/x/cert/client/cli" - "github.com/akash-network/node/x/deployment/client/cli" + "pkg.akt.dev/go/cli" + + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/network" + atypes "pkg.akt.dev/akashd/types" + ccli "pkg.akt.dev/akashd/x/cert/client/cli" + dcli "pkg.akt.dev/akashd/x/deployment/client/cli" ) type GRPCRestTestSuite struct { @@ -26,7 +28,7 @@ type GRPCRestTestSuite struct { cfg network.Config network *network.Network - deployment types.QueryDeploymentResponse + deployment v1beta4.QueryDeploymentResponse } func (s *GRPCRestTestSuite) SetupSuite() { @@ -60,39 +62,39 @@ func (s *GRPCRestTestSuite) SetupSuite() { context.Background(), val.ClientCtx, val.Address, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // create deployment - _, err = cli.TxCreateDeploymentExec( + _, err = dcli.TxCreateDeploymentExec( val.ClientCtx, val.Address, deploymentPath, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--deposit=%s", cli.DefaultDeposit), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), + fmt.Sprintf("--deposit=%s", dcli.DefaultDeposit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // get deployment - resp, err := cli.QueryDeploymentsExec(val.ClientCtx.WithOutputFormat("json")) + resp, err := dcli.QueryDeploymentsExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) - out := &types.QueryDeploymentsResponse{} + out := &v1beta4.QueryDeploymentsResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), out) s.Require().NoError(err) s.Require().Len(out.Deployments, 1, "Cert Create Failed") deployments := out.Deployments - s.Require().Equal(val.Address.String(), deployments[0].Deployment.DeploymentID.Owner) + s.Require().Equal(val.Address.String(), deployments[0].Deployment.ID.Owner) s.deployment = deployments[0] } @@ -105,12 +107,12 @@ func (s *GRPCRestTestSuite) TestGetDeployments() { name string url string expErr bool - expResp types.QueryDeploymentResponse + expResp v1beta4.QueryDeploymentResponse expLen int }{ { "get deployments without filters", - fmt.Sprintf("%s/akash/deployment/%s/deployments/list", val.APIAddress, atypes.ProtoAPIVersion), + fmt.Sprintf("%s/akash/deployment/%s/deployments/list", val.APIAddress, v1beta4.GatewayVersion), false, deployment, 1, @@ -118,24 +120,24 @@ func (s *GRPCRestTestSuite) TestGetDeployments() { { "get deployments with filters", fmt.Sprintf("%s/akash/deployment/%s/deployments/list?filters.owner=%s", val.APIAddress, - atypes.ProtoAPIVersion, - deployment.Deployment.DeploymentID.Owner), + v1beta4.GatewayVersion, + deployment.Deployment.ID.Owner), false, deployment, 1, }, { "get deployments with wrong state filter", - fmt.Sprintf("%s/akash/deployment/%s/deployments/list?filters.state=%s", val.APIAddress, atypes.ProtoAPIVersion, - types.DeploymentStateInvalid.String()), + fmt.Sprintf("%s/akash/deployment/%s/deployments/list?filters.state=%s", val.APIAddress, v1beta4.GatewayVersion, + v1.DeploymentStateInvalid.String()), true, - types.QueryDeploymentResponse{}, + v1beta4.QueryDeploymentResponse{}, 0, }, { "get deployments with two filters", fmt.Sprintf("%s/akash/deployment/%s/deployments/list?filters.state=%s&filters.dseq=%d", - val.APIAddress, atypes.ProtoAPIVersion, deployment.Deployment.State.String(), deployment.Deployment.DeploymentID.DSeq), + val.APIAddress, v1beta4.GatewayVersion, deployment.Deployment.State.String(), deployment.Deployment.ID.DSeq), false, deployment, 1, @@ -145,10 +147,10 @@ func (s *GRPCRestTestSuite) TestGetDeployments() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var deployments types.QueryDeploymentsResponse + var deployments v1beta4.QueryDeploymentsResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &deployments) if tc.expErr { @@ -171,38 +173,38 @@ func (s *GRPCRestTestSuite) TestGetDeployment() { name string url string expErr bool - expResp types.QueryDeploymentResponse + expResp v1beta4.QueryDeploymentResponse }{ { "get deployment with empty input", fmt.Sprintf("%s/akash/deployment/%s/deployments/info", val.APIAddress, atypes.ProtoAPIVersion), true, - types.QueryDeploymentResponse{}, + v1beta4.QueryDeploymentResponse{}, }, { "get deployment with invalid input", fmt.Sprintf("%s/akash/deployment/%s/deployments/info?id.owner=%s", val.APIAddress, atypes.ProtoAPIVersion, - deployment.Deployment.DeploymentID.Owner), + deployment.Deployment.ID.Owner), true, - types.QueryDeploymentResponse{}, + v1beta4.QueryDeploymentResponse{}, }, { "deployment not found", fmt.Sprintf("%s/akash/deployment/%s/deployments/info?id.owner=%s&id.dseq=%d", val.APIAddress, atypes.ProtoAPIVersion, - deployment.Deployment.DeploymentID.Owner, + deployment.Deployment.ID.Owner, 249), true, - types.QueryDeploymentResponse{}, + v1beta4.QueryDeploymentResponse{}, }, { "valid get deployment request", fmt.Sprintf("%s/akash/deployment/%s/deployments/info?id.owner=%s&id.dseq=%d", val.APIAddress, atypes.ProtoAPIVersion, - deployment.Deployment.DeploymentID.Owner, - deployment.Deployment.DeploymentID.DSeq), + deployment.Deployment.ID.Owner, + deployment.Deployment.ID.DSeq), false, deployment, }, @@ -211,10 +213,10 @@ func (s *GRPCRestTestSuite) TestGetDeployment() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var out types.QueryDeploymentResponse + var out v1beta4.QueryDeploymentResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &out) if tc.expErr { @@ -237,39 +239,39 @@ func (s *GRPCRestTestSuite) TestGetGroup() { name string url string expErr bool - expResp types.Group + expResp v1beta4.Group }{ { "get group with empty input", fmt.Sprintf("%s/akash/deployment/%s/groups/info", val.APIAddress, atypes.ProtoAPIVersion), true, - types.Group{}, + v1beta4.Group{}, }, { "get group with invalid input", fmt.Sprintf("%s/akash/deployment/%s/groups/info?id.owner=%s", val.APIAddress, atypes.ProtoAPIVersion, - group.GroupID.Owner), + group.ID.Owner), true, - types.Group{}, + v1beta4.Group{}, }, { "group not found", fmt.Sprintf("%s/akash/deployment/%s/groups/info?id.owner=%s&id.dseq=%d", val.APIAddress, atypes.ProtoAPIVersion, - group.GroupID.Owner, + group.ID.Owner, 249), true, - types.Group{}, + v1beta4.Group{}, }, { "valid get group request", fmt.Sprintf("%s/akash/deployment/%s/groups/info?id.owner=%s&id.dseq=%d&id.gseq=%d", val.APIAddress, atypes.ProtoAPIVersion, - group.GroupID.Owner, - group.GroupID.DSeq, - group.GroupID.GSeq), + group.ID.Owner, + group.ID.DSeq, + group.ID.GSeq), false, group, }, @@ -278,10 +280,10 @@ func (s *GRPCRestTestSuite) TestGetGroup() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var out types.QueryGroupResponse + var out v1beta4.QueryGroupResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &out) if tc.expErr { diff --git a/x/deployment/client/cli/query.go b/x/deployment/client/cli/query.go index d8f997b856..78660491ae 100644 --- a/x/deployment/client/cli/query.go +++ b/x/deployment/client/cli/query.go @@ -3,19 +3,22 @@ package cli import ( "context" - sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + sdkclient "github.com/cosmos/cosmos-sdk/client" + + "pkg.akt.dev/go/cli" + + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" - aclient "github.com/akash-network/node/client" + aclient "pkg.akt.dev/akashd/client" ) // GetQueryCmd returns the query commands for the deployment module func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ - Use: types.ModuleName, + Use: v1.ModuleName, Short: "Deployment query commands", SuggestionsMinimumDistance: 2, RunE: sdkclient.ValidateCmd, @@ -58,7 +61,7 @@ func cmdDeployments() *cobra.Command { return err } - params := &types.QueryDeploymentsRequest{ + params := &v1beta4.QueryDeploymentsRequest{ Filters: dfilters, Pagination: pageReq, } @@ -72,8 +75,8 @@ func cmdDeployments() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, "deployments") + cli.AddQueryFlagsToCmd(cmd) + cli.AddPaginationFlagsToCmd(cmd, "deployments") AddDeploymentFilterFlags(cmd.Flags()) return cmd @@ -102,7 +105,7 @@ func cmdDeployment() *cobra.Command { return err } - res, err := qq.Deployment(context.Background(), &types.QueryDeploymentRequest{ID: id}) + res, err := qq.Deployment(context.Background(), &v1beta4.QueryDeploymentRequest{ID: id}) if err != nil { return err } @@ -111,7 +114,7 @@ func cmdDeployment() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) + cli.AddQueryFlagsToCmd(cmd) AddDeploymentIDFlags(cmd.Flags()) MarkReqDeploymentIDFlags(cmd) @@ -156,7 +159,7 @@ func cmdGetGroup() *cobra.Command { return err } - res, err := qq.Group(cmd.Context(), &types.QueryGroupRequest{ID: id}) + res, err := qq.Group(cmd.Context(), &v1beta4.QueryGroupRequest{ID: id}) if err != nil { return err } @@ -165,7 +168,7 @@ func cmdGetGroup() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) + cli.AddQueryFlagsToCmd(cmd) AddGroupIDFlags(cmd.Flags()) MarkReqGroupIDFlags(cmd) diff --git a/x/deployment/client/cli/test_helpers.go b/x/deployment/client/cli/test_helpers.go index be86a43a95..76cd38d9dd 100644 --- a/x/deployment/client/cli/test_helpers.go +++ b/x/deployment/client/cli/test_helpers.go @@ -9,12 +9,13 @@ import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + dv1 "pkg.akt.dev/go/node/deployment/v1" + dv1beta4 "pkg.akt.dev/go/node/deployment/v1beta4" - testutilcli "github.com/akash-network/node/testutil/cli" + testutilcli "pkg.akt.dev/akashd/testutil/cli" ) -const key string = types.StoreKey +const key string = dv1.StoreKey // XXX: WHY TF DON'T THESE RETURN OBJECTS @@ -67,7 +68,7 @@ func TxDepositDeploymentExec(clientCtx client.Context, deposit sdk.Coin, from fm } // TxCloseGroupExec is used for testing close group tx -func TxCloseGroupExec(clientCtx client.Context, groupID types.GroupID, from fmt.Stringer, extraArgs ...string) (sdktest.BufferWriter, error) { +func TxCloseGroupExec(clientCtx client.Context, groupID dv1.GroupID, from fmt.Stringer, extraArgs ...string) (sdktest.BufferWriter, error) { args := []string{ fmt.Sprintf("--from=%s", from.String()), fmt.Sprintf("--owner=%s", groupID.Owner), @@ -86,7 +87,7 @@ func QueryDeploymentsExec(clientCtx client.Context, extraArgs ...string) (sdktes } // QueryDeploymentExec is used for testing deployment query -func QueryDeploymentExec(clientCtx client.Context, id types.DeploymentID, extraArgs ...string) (sdktest.BufferWriter, error) { +func QueryDeploymentExec(clientCtx client.Context, id dv1.DeploymentID, extraArgs ...string) (sdktest.BufferWriter, error) { args := []string{ fmt.Sprintf("--owner=%s", id.Owner), fmt.Sprintf("--dseq=%v", id.DSeq), @@ -98,7 +99,7 @@ func QueryDeploymentExec(clientCtx client.Context, id types.DeploymentID, extraA } // QueryGroupExec is used for testing group query -func QueryGroupExec(clientCtx client.Context, id types.GroupID, extraArgs ...string) (sdktest.BufferWriter, error) { +func QueryGroupExec(clientCtx client.Context, id dv1.GroupID, extraArgs ...string) (sdktest.BufferWriter, error) { args := []string{ fmt.Sprintf("--owner=%s", id.Owner), fmt.Sprintf("--dseq=%v", id.DSeq), @@ -111,8 +112,7 @@ func QueryGroupExec(clientCtx client.Context, id types.GroupID, extraArgs ...str } func TxGrantAuthorizationExec(clientCtx client.Context, granter, grantee sdk.AccAddress, extraArgs ...string) (sdktest.BufferWriter, error) { - - dmin, _ := types.DefaultParams().MinDepositFor("uakt") + dmin, _ := dv1beta4.DefaultParams().MinDepositFor("uakt") spendLimit := sdk.NewCoin(dmin.Denom, dmin.Amount.MulRaw(3)) args := []string{ diff --git a/x/deployment/client/cli/tx.go b/x/deployment/client/cli/tx.go index 154c665b7e..b8789a0a25 100644 --- a/x/deployment/client/cli/tx.go +++ b/x/deployment/client/cli/tx.go @@ -8,22 +8,24 @@ import ( "strings" "time" - cltypes "github.com/akash-network/akash-api/go/node/client/types" + tmrpc "github.com/cometbft/cometbft/rpc/core/types" "github.com/spf13/cobra" - tmrpc "github.com/tendermint/tendermint/rpc/core/types" sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/akash-api/go/node/types/constants" + cltypes "pkg.akt.dev/go/node/client/types" + "pkg.akt.dev/go/sdl" - aclient "github.com/akash-network/node/client" - "github.com/akash-network/node/cmd/common" - "github.com/akash-network/node/sdl" - cutils "github.com/akash-network/node/x/cert/utils" + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" + "pkg.akt.dev/go/node/types/constants" + + aclient "pkg.akt.dev/akashd/client" + "pkg.akt.dev/akashd/cmd/common" + cutils "pkg.akt.dev/akashd/x/cert/utils" ) var ( @@ -34,7 +36,7 @@ var ( // GetTxCmd returns the transaction commands for this module func GetTxCmd(key string) *cobra.Command { cmd := &cobra.Command{ - Use: types.ModuleName, + Use: v1.ModuleName, Short: "Deployment transaction subcommands", SuggestionsMinimumDistance: 2, RunE: sdkclient.ValidateCmd, @@ -129,16 +131,16 @@ func cmdCreate(key string) *cobra.Command { return err } - msg := &types.MsgCreateDeployment{ + msg := &v1beta4.MsgCreateDeployment{ ID: id, - Version: version, - Groups: make([]types.GroupSpec, 0, len(groups)), + Hash: version, + Groups: make(v1beta4.GroupSpecs, 0, len(groups)), Deposit: deposit, Depositor: depositorAcc, } for _, group := range groups { - msg.Groups = append(msg.Groups, *group) + msg.Groups = append(msg.Groups, group) } if err := msg.ValidateBasic(); err != nil { @@ -200,7 +202,7 @@ func cmdDeposit(key string) *cobra.Command { return err } - msg := &types.MsgDepositDeployment{ + msg := &v1.MsgDepositDeployment{ ID: id, Amount: deposit, Depositor: depositorAcc, @@ -250,7 +252,7 @@ func cmdClose(key string) *cobra.Command { return err } - msg := &types.MsgCloseDeployment{ID: id} + msg := &v1beta4.MsgCloseDeployment{ID: id} resp, err := cl.Tx().Broadcast(ctx, []sdk.Msg{msg}) if err != nil { @@ -299,7 +301,7 @@ func cmdUpdate(key string) *cobra.Command { return err } - version, err := sdlManifest.Version() + hash, err := sdlManifest.Version() if err != nil { return err } @@ -310,7 +312,7 @@ func cmdUpdate(key string) *cobra.Command { } // Query the RPC node to make sure the existing groups are identical - existingDeployment, err := cl.Query().Deployment(cmd.Context(), &types.QueryDeploymentRequest{ + existingDeployment, err := cl.Query().Deployment(cmd.Context(), &v1beta4.QueryDeploymentRequest{ ID: id, }) if err != nil { @@ -331,9 +333,9 @@ func cmdUpdate(key string) *cobra.Command { warnIfGroupVolumesExceeds(cctx, groups) - msg := &types.MsgUpdateDeployment{ - ID: id, - Version: version, + msg := &v1beta4.MsgUpdateDeployment{ + ID: id, + Hash: hash, } resp, err := cl.Tx().Broadcast(ctx, []sdk.Msg{msg}) @@ -395,7 +397,7 @@ func cmdGroupClose(_ string) *cobra.Command { return err } - msg := &types.MsgCloseGroup{ + msg := &v1beta4.MsgCloseGroup{ ID: id, } @@ -448,7 +450,7 @@ func cmdGroupPause(_ string) *cobra.Command { return err } - msg := &types.MsgPauseGroup{ + msg := &v1beta4.MsgPauseGroup{ ID: id, } @@ -501,7 +503,7 @@ func cmdGroupStart(_ string) *cobra.Command { return err } - msg := &types.MsgStartGroup{ + msg := &v1beta4.MsgStartGroup{ ID: id, } @@ -550,7 +552,7 @@ func cmdGrantAuthorization() *cobra.Command { Examples: $ akash tx %s authz grant akash1skjw.. 50akt --from=akash1skl.. $ akash tx %s authz grant akash1skjw.. 50akt --from=akash1skl.. --expiration=1661020200 - `, types.ModuleName, types.ModuleName), + `, v1.ModuleName, v1.ModuleName), ), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { @@ -590,9 +592,10 @@ Examples: } granter := cctx.GetFromAddress() - authorization := types.NewDepositDeploymentAuthorization(spendLimit) + authorization := v1.NewDepositAuthorization(spendLimit) - msg, err := authz.NewMsgGrant(granter, grantee, authorization, time.Unix(exp, 0)) + expiry := time.Unix(exp, 0) + msg, err := authz.NewMsgGrant(granter, grantee, authorization, &expiry) if err != nil { return err } @@ -621,7 +624,7 @@ func cmdRevokeAuthorization() *cobra.Command { fmt.Sprintf(`revoke deposit deployment authorization from a granter to a grantee: Example: $ akash tx %s authz revoke akash1skj.. --from=akash1skj.. - `, types.ModuleName), + `, v1.ModuleName), ), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -648,7 +651,7 @@ Example: } granter := cctx.GetFromAddress() - msgTypeURL := types.DepositDeploymentAuthorization{}.MsgTypeURL() + msgTypeURL := v1.DepositAuthorization{}.MsgTypeURL() msg := authz.NewMsgRevoke(granter, grantee, msgTypeURL) resp, err := cl.Tx().Broadcast(ctx, []sdk.Msg{&msg}) @@ -666,7 +669,7 @@ Example: return cmd } -func warnIfGroupVolumesExceeds(cctx sdkclient.Context, dgroups []*types.GroupSpec) { +func warnIfGroupVolumesExceeds(cctx sdkclient.Context, dgroups v1beta4.GroupSpecs) { for _, group := range dgroups { for _, resources := range group.GetResourceUnits() { if len(resources.Resources.Storage) > constants.DefaultMaxGroupVolumes { diff --git a/x/deployment/client/cli/util.go b/x/deployment/client/cli/util.go deleted file mode 100644 index ccd40339f8..0000000000 --- a/x/deployment/client/cli/util.go +++ /dev/null @@ -1,20 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" -) - -// CurrentBlockHeight returns current block height of node -func CurrentBlockHeight(ctx client.Context) (uint64, error) { - client, err := ctx.GetNode() - if err != nil { - return 0, err - } - status, err := client.Status(context.Background()) - if err != nil { - return 0, err - } - return uint64(status.SyncInfo.LatestBlockHeight), nil -} diff --git a/x/deployment/client/rest/params.go b/x/deployment/client/rest/params.go index 353490cd85..91ecbd381a 100644 --- a/x/deployment/client/rest/params.go +++ b/x/deployment/client/rest/params.go @@ -5,64 +5,63 @@ import ( "strconv" sdk "github.com/cosmos/cosmos-sdk/types" - - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/node/x/deployment/query" + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" ) // DeploymentIDFromRequest returns DeploymentID from parsing request -func DeploymentIDFromRequest(r *http.Request) (types.DeploymentID, string) { +func DeploymentIDFromRequest(r *http.Request) (v1.DeploymentID, string) { ownerAddr := r.URL.Query().Get("owner") dseqNo := r.URL.Query().Get("dseq") - var id types.DeploymentID + var id v1.DeploymentID if len(ownerAddr) != 0 { _, err := sdk.AccAddressFromBech32(ownerAddr) if err != nil { - return types.DeploymentID{}, err.Error() + return v1.DeploymentID{}, err.Error() } id.Owner = ownerAddr } else { - return types.DeploymentID{}, "Missing owner query param" + return v1.DeploymentID{}, "Missing owner query param" } if len(dseqNo) != 0 { dseq, err := strconv.ParseUint(dseqNo, 10, 64) if err != nil { - return types.DeploymentID{}, err.Error() + return v1.DeploymentID{}, err.Error() } id.DSeq = dseq } else { - return types.DeploymentID{}, "Missing dseq query param" + return v1.DeploymentID{}, "Missing dseq query param" } return id, "" } // DepFiltersFromRequest returns DeploymentFilters with given params in request -func DepFiltersFromRequest(r *http.Request) (query.DeploymentFilters, string) { +func DepFiltersFromRequest(r *http.Request) (v1beta4.DeploymentFilters, string) { ownerAddr := r.URL.Query().Get("owner") state := r.URL.Query().Get("state") - var dfilters query.DeploymentFilters + var dfilters v1beta4.DeploymentFilters if len(ownerAddr) != 0 { owner, err := sdk.AccAddressFromBech32(ownerAddr) if err != nil { - return query.DeploymentFilters{}, err.Error() + return v1beta4.DeploymentFilters{}, err.Error() } - dfilters.Owner = owner + dfilters.Owner = owner.String() } if len(state) != 0 { - dfilters.StateFlagVal = state + dfilters.State = state } return dfilters, "" } // GroupIDFromRequest returns GroupID from parsing request -func GroupIDFromRequest(r *http.Request) (types.GroupID, string) { +func GroupIDFromRequest(r *http.Request) (v1.GroupID, string) { dID, errMsg := DeploymentIDFromRequest(r) if len(errMsg) != 0 { - return types.GroupID{}, errMsg + return v1.GroupID{}, errMsg } gseqNo := r.URL.Query().Get("gseq") @@ -71,25 +70,25 @@ func GroupIDFromRequest(r *http.Request) (types.GroupID, string) { if len(gseqNo) != 0 { num, err := strconv.ParseUint(gseqNo, 10, 32) if err != nil { - return types.GroupID{}, err.Error() + return v1.GroupID{}, err.Error() } gseq = uint32(num) } else { - return types.GroupID{}, "Missing oseq query param" + return v1.GroupID{}, "Missing oseq query param" } - return types.MakeGroupID(dID, gseq), "" + return v1.MakeGroupID(dID, gseq), "" } // GroupFiltersFromRequest returns GroupFilters with given params in request -func GroupFiltersFromRequest(r *http.Request) (query.GroupFilters, string) { +func GroupFiltersFromRequest(r *http.Request) (v1beta4.GroupFilters, string) { dfilters, errMsg := DepFiltersFromRequest(r) if len(errMsg) != 0 { - return query.GroupFilters{}, errMsg + return v1beta4.GroupFilters{}, errMsg } - gfilters := query.GroupFilters{ - Owner: dfilters.Owner, - StateFlagVal: dfilters.StateFlagVal, + gfilters := v1beta4.GroupFilters{ + Owner: dfilters.Owner, + State: dfilters.State, } return gfilters, "" } diff --git a/x/deployment/client/rest/rest.go b/x/deployment/client/rest/rest.go index c4ee5fdbf9..d28c84f61b 100644 --- a/x/deployment/client/rest/rest.go +++ b/x/deployment/client/rest/rest.go @@ -1,80 +1,74 @@ package rest import ( - "fmt" - "net/http" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" - - "github.com/akash-network/node/x/deployment/query" ) // RegisterRoutes registers all query routes func RegisterRoutes(ctx client.Context, r *mux.Router, ns string) { - // Get all deployments - r.HandleFunc(fmt.Sprintf("/%s/list", ns), listDeploymentsHandler(ctx, ns)).Methods("GET") - - // Get single deployment info - r.HandleFunc(fmt.Sprintf("/%s/info", ns), getDeploymentHandler(ctx, ns)).Methods("GET") - - // Get single group info - r.HandleFunc(fmt.Sprintf("/%s/group/info", ns), getGroupHandler(ctx, ns)).Methods("GET") + // // Get all deployments + // r.HandleFunc(fmt.Sprintf("/%s/list", ns), listDeploymentsHandler(ctx, ns)).Methods("GET") + // + // // Get single deployment info + // r.HandleFunc(fmt.Sprintf("/%s/info", ns), getDeploymentHandler(ctx, ns)).Methods("GET") + // + // // Get single group info + // r.HandleFunc(fmt.Sprintf("/%s/group/info", ns), getGroupHandler(ctx, ns)).Methods("GET") } -func listDeploymentsHandler(ctx client.Context, ns string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - dfilters, errMsg := DepFiltersFromRequest(r) - - if len(errMsg) != 0 { - rest.WriteErrorResponse(w, http.StatusBadRequest, errMsg) - return - } - - res, err := query.NewRawClient(ctx, ns).Deployments(dfilters) - if err != nil { - rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") - return - } - rest.PostProcessResponse(w, ctx, res) - } -} - -func getDeploymentHandler(ctx client.Context, ns string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - - id, errMsg := DeploymentIDFromRequest(r) - - if len(errMsg) != 0 { - rest.WriteErrorResponse(w, http.StatusBadRequest, errMsg) - return - } - - res, err := query.NewRawClient(ctx, ns).Deployment(id) - if err != nil { - rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") - return - } - rest.PostProcessResponse(w, ctx, res) - } -} - -func getGroupHandler(ctx client.Context, ns string) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - - id, errMsg := GroupIDFromRequest(r) - - if len(errMsg) != 0 { - rest.WriteErrorResponse(w, http.StatusBadRequest, errMsg) - return - } - - res, err := query.NewRawClient(ctx, ns).Group(id) - if err != nil { - rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") - return - } - rest.PostProcessResponse(w, ctx, res) - } -} +// func listDeploymentsHandler(ctx client.Context, ns string) http.HandlerFunc { +// return func(w http.ResponseWriter, r *http.Request) { +// dfilters, errMsg := DepFiltersFromRequest(r) +// +// if len(errMsg) != 0 { +// rest.WriteErrorResponse(w, http.StatusBadRequest, errMsg) +// return +// } +// +// res, err := query.NewRawClient(ctx, ns).Deployments(dfilters) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") +// return +// } +// rest.PostProcessResponse(w, ctx, res) +// } +// } +// +// func getDeploymentHandler(ctx client.Context, ns string) http.HandlerFunc { +// return func(w http.ResponseWriter, r *http.Request) { +// +// id, errMsg := DeploymentIDFromRequest(r) +// +// if len(errMsg) != 0 { +// rest.WriteErrorResponse(w, http.StatusBadRequest, errMsg) +// return +// } +// +// res, err := query.NewRawClient(ctx, ns).Deployment(id) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") +// return +// } +// rest.PostProcessResponse(w, ctx, res) +// } +// } +// +// func getGroupHandler(ctx client.Context, ns string) http.HandlerFunc { +// return func(w http.ResponseWriter, r *http.Request) { +// +// id, errMsg := GroupIDFromRequest(r) +// +// if len(errMsg) != 0 { +// rest.WriteErrorResponse(w, http.StatusBadRequest, errMsg) +// return +// } +// +// res, err := query.NewRawClient(ctx, ns).Group(id) +// if err != nil { +// rest.WriteErrorResponse(w, http.StatusNotFound, "Not Found") +// return +// } +// rest.PostProcessResponse(w, ctx, res) +// } +// } diff --git a/x/deployment/genesis.go b/x/deployment/genesis.go index de4a70337e..57d842e929 100644 --- a/x/deployment/genesis.go +++ b/x/deployment/genesis.go @@ -4,21 +4,22 @@ import ( "encoding/json" "fmt" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" - "github.com/akash-network/node/x/deployment/keeper" + "pkg.akt.dev/akashd/x/deployment/keeper" ) // ValidateGenesis does validation check of the Genesis and return error in case of failure -func ValidateGenesis(data *types.GenesisState) error { +func ValidateGenesis(data *v1beta4.GenesisState) error { for _, record := range data.Deployments { - if err := record.Deployment.ID().Validate(); err != nil { - return fmt.Errorf("%w: %s", err, types.ErrInvalidDeployment.Error()) + if err := record.Deployment.ID.Validate(); err != nil { + return fmt.Errorf("%w: %s", err, v1.ErrInvalidDeployment.Error()) } } return data.Params.Validate() @@ -26,14 +27,14 @@ func ValidateGenesis(data *types.GenesisState) error { // DefaultGenesisState returns default genesis state as raw bytes for the deployment // module. -func DefaultGenesisState() *types.GenesisState { - return &types.GenesisState{ - Params: types.DefaultParams(), +func DefaultGenesisState() *v1beta4.GenesisState { + return &v1beta4.GenesisState{ + Params: v1beta4.DefaultParams(), } } // InitGenesis initiate genesis state and return updated validator details -func InitGenesis(ctx sdk.Context, keeper keeper.IKeeper, data *types.GenesisState) []abci.ValidatorUpdate { +func InitGenesis(ctx sdk.Context, keeper keeper.IKeeper, data *v1beta4.GenesisState) []abci.ValidatorUpdate { for _, record := range data.Deployments { if err := keeper.Create(ctx, record.Deployment, record.Groups); err != nil { return nil @@ -44,11 +45,11 @@ func InitGenesis(ctx sdk.Context, keeper keeper.IKeeper, data *types.GenesisStat } // ExportGenesis returns genesis state for the deployment module -func ExportGenesis(ctx sdk.Context, k keeper.IKeeper) *types.GenesisState { - var records []types.GenesisDeployment - k.WithDeployments(ctx, func(deployment types.Deployment) bool { - groups := k.GetGroups(ctx, deployment.ID()) - records = append(records, types.GenesisDeployment{ +func ExportGenesis(ctx sdk.Context, k keeper.IKeeper) *v1beta4.GenesisState { + var records []v1beta4.GenesisDeployment + k.WithDeployments(ctx, func(deployment v1.Deployment) bool { + groups := k.GetGroups(ctx, deployment.ID) + records = append(records, v1beta4.GenesisDeployment{ Deployment: deployment, Groups: groups, }) @@ -56,7 +57,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.IKeeper) *types.GenesisState { }) params := k.GetParams(ctx) - return &types.GenesisState{ + return &v1beta4.GenesisState{ Deployments: records, Params: params, } @@ -64,8 +65,8 @@ func ExportGenesis(ctx sdk.Context, k keeper.IKeeper) *types.GenesisState { // GetGenesisStateFromAppState returns x/deployment GenesisState given raw application // genesis state. -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *types.GenesisState { - var genesisState types.GenesisState +func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *v1beta4.GenesisState { + var genesisState v1beta4.GenesisState if appState[ModuleName] != nil { cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) diff --git a/x/deployment/handler/handler.go b/x/deployment/handler/handler.go index 4643f252d4..5b5ca4b0af 100644 --- a/x/deployment/handler/handler.go +++ b/x/deployment/handler/handler.go @@ -4,9 +4,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + v1 "pkg.akt.dev/go/node/deployment/v1" + types "pkg.akt.dev/go/node/deployment/v1beta4" - "github.com/akash-network/node/x/deployment/keeper" + "pkg.akt.dev/akashd/x/deployment/keeper" ) // NewHandler returns a handler for "deployment" type messages @@ -19,7 +20,7 @@ func NewHandler(keeper keeper.IKeeper, mkeeper MarketKeeper, ekeeper EscrowKeepe res, err := ms.CreateDeployment(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgDepositDeployment: + case *v1.MsgDepositDeployment: res, err := ms.DepositDeployment(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) diff --git a/x/deployment/handler/handler_test.go b/x/deployment/handler/handler_test.go index 62730b26c7..cfc305a8b9 100644 --- a/x/deployment/handler/handler_test.go +++ b/x/deployment/handler/handler_test.go @@ -6,10 +6,6 @@ import ( "testing" "time" - "github.com/akash-network/node/sdl" - - "github.com/akash-network/node/x/deployment/handler" - sdktestdata "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -17,13 +13,15 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" - "github.com/akash-network/node/testutil" - cmocks "github.com/akash-network/node/testutil/cosmos/mocks" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/deployment/keeper" - mkeeper "github.com/akash-network/node/x/market/keeper" + "pkg.akt.dev/akashd/testutil" + cmocks "pkg.akt.dev/akashd/testutil/cosmos/mocks" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/deployment/handler" + "pkg.akt.dev/akashd/x/deployment/keeper" + mkeeper "pkg.akt.dev/akashd/x/market/keeper" ) type testSuite struct { @@ -39,36 +37,36 @@ type testSuite struct { } func setupTestSuite(t *testing.T) *testSuite { - defaultDeposit, err := types.DefaultParams().MinDepositFor("uakt") + defaultDeposit, err := v1beta4.DefaultParams().MinDepositFor("uakt") require.NoError(t, err) depositor := testutil.AccAddress(t) authzKeeper := &cmocks.AuthzKeeper{} authzKeeper. - On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&types.MsgDepositDeployment{})). - Return(&types.DepositDeploymentAuthorization{ + On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&v1.MsgDepositDeployment{})). + Return(&v1.DepositAuthorization{ SpendLimit: defaultDeposit.Add(defaultDeposit), }, time.Time{}). Once(). - On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&types.MsgDepositDeployment{})). - Return(&types.DepositDeploymentAuthorization{ + On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&v1.MsgDepositDeployment{})). + Return(&v1.DepositAuthorization{ SpendLimit: defaultDeposit, }, time.Time{}). Once(). - On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&types.MsgDepositDeployment{})). - Return(&types.DepositDeploymentAuthorization{ + On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&v1.MsgDepositDeployment{})). + Return(&v1.DepositAuthorization{ SpendLimit: defaultDeposit, }, time.Time{}). Once(). - On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&types.MsgDepositDeployment{})). - Return(&types.DepositDeploymentAuthorization{ + On("GetCleanAuthorization", mock.Anything, mock.Anything, depositor, sdk.MsgTypeURL(&v1.MsgDepositDeployment{})). + Return(&v1.DepositAuthorization{ SpendLimit: defaultDeposit, }, time.Time{}). Once(). On("GetCleanAuthorization", mock.Anything, mock.Anything, mock.MatchedBy(func(addr sdk.AccAddress) bool { return !depositor.Equals(addr) - }), sdk.MsgTypeURL(&types.MsgDepositDeployment{})). + }), sdk.MsgTypeURL(&v1.MsgDepositDeployment{})). Return(nil, time.Time{}) authzKeeper. On("DeleteGrant", mock.Anything, mock.Anything, mock.Anything, mock.Anything). @@ -113,11 +111,11 @@ func TestCreateDeployment(t *testing.T) { deployment, groups := suite.createDeployment() - msg := &types.MsgCreateDeployment{ - ID: deployment.ID(), - Groups: make([]types.GroupSpec, 0, len(groups)), + msg := &v1beta4.MsgCreateDeployment{ + ID: deployment.ID, + Groups: make(v1beta4.GroupSpecs, 0, len(groups)), Deposit: suite.defaultDeposit, - Depositor: deployment.ID().Owner, + Depositor: deployment.ID.Owner, } for _, group := range groups { @@ -131,18 +129,18 @@ func TestCreateDeployment(t *testing.T) { t.Run("ensure event created", func(t *testing.T) { t.Skip("now has more events") iev := testutil.ParseDeploymentEvent(t, res.Events) - require.IsType(t, types.EventDeploymentCreated{}, iev) + require.IsType(t, v1beta4.EventDeploymentCreated{}, iev) - dev := iev.(types.EventDeploymentCreated) + dev := iev.(v1beta4.EventDeploymentCreated) require.Equal(t, msg.ID, dev.ID) }) - deploymentResult, exists := suite.dkeeper.GetDeployment(suite.ctx, deployment.ID()) + deploymentResult, exists := suite.dkeeper.GetDeployment(suite.ctx, deployment.ID) require.True(t, exists) - require.Equal(t, deploymentResult.Version, msg.Version) + require.Equal(t, deploymentResult.Hash, msg.Hash) - groupsResult := suite.dkeeper.GetGroups(suite.ctx, deployment.ID()) + groupsResult := suite.dkeeper.GetGroups(suite.ctx, deployment.ID) require.NotEmpty(t, groupsResult) require.Equal(t, len(groupsResult), len(groups)) @@ -151,7 +149,7 @@ func TestCreateDeployment(t *testing.T) { } res, err = suite.handler(suite.ctx, msg) - require.EqualError(t, err, types.ErrDeploymentExists.Error()) + require.EqualError(t, err, v1.ErrDeploymentExists.Error()) require.Nil(t, res) } @@ -160,14 +158,14 @@ func TestCreateDeploymentEmptyGroups(t *testing.T) { deployment := testutil.Deployment(suite.t) - msg := &types.MsgCreateDeployment{ - ID: deployment.ID(), + msg := &v1beta4.MsgCreateDeployment{ + ID: deployment.ID, Deposit: suite.defaultDeposit, } res, err := suite.handler(suite.ctx, msg) require.Nil(t, res) - require.True(t, errors.Is(err, types.ErrInvalidGroups)) + require.True(t, errors.Is(err, v1.ErrInvalidGroups)) } func TestUpdateDeploymentNonExisting(t *testing.T) { @@ -175,13 +173,13 @@ func TestUpdateDeploymentNonExisting(t *testing.T) { deployment := testutil.Deployment(suite.t) - msg := &types.MsgUpdateDeployment{ - ID: deployment.ID(), + msg := &v1beta4.MsgUpdateDeployment{ + ID: deployment.ID, } res, err := suite.handler(suite.ctx, msg) require.Nil(t, res) - require.EqualError(t, err, types.ErrDeploymentNotFound.Error()) + require.EqualError(t, err, v1.ErrDeploymentNotFound.Error()) } func TestUpdateDeploymentExisting(t *testing.T) { @@ -189,25 +187,21 @@ func TestUpdateDeploymentExisting(t *testing.T) { deployment, groups := suite.createDeployment() - sdlObj, err := sdl.ReadFile("../../../sdl/_testdata/simple.yaml") - require.NoError(t, err) - - dgroups, err := sdlObj.DeploymentGroups() - require.NoError(t, err) + testutil.GroupSpec(t) - msgGroups := make([]types.GroupSpec, 0) - for _, g := range dgroups { - msgGroups = append(msgGroups, *g) + msgGroupSpecs := make(v1beta4.GroupSpecs, 0) + for _, g := range groups { + msgGroupSpecs = append(msgGroupSpecs, g.GroupSpec) } - require.NotEmpty(t, msgGroups) - require.Equal(t, len(msgGroups), 1) + require.NotEmpty(t, msgGroupSpecs) + require.Equal(t, len(msgGroupSpecs), 1) - msg := &types.MsgCreateDeployment{ - ID: deployment.ID(), - Groups: msgGroups, - Version: testutil.DefaultDeploymentVersion[:], + msg := &v1beta4.MsgCreateDeployment{ + ID: deployment.ID, + Groups: msgGroupSpecs, + Hash: testutil.DefaultDeploymentHash[:], Deposit: suite.defaultDeposit, - Depositor: deployment.ID().Owner, + Depositor: deployment.ID.Owner, } for _, group := range groups { @@ -219,17 +213,17 @@ func TestUpdateDeploymentExisting(t *testing.T) { require.NotNil(t, res) t.Run("assert deployment version", func(t *testing.T) { - d, ok := suite.dkeeper.GetDeployment(suite.ctx, deployment.DeploymentID) + d, ok := suite.dkeeper.GetDeployment(suite.ctx, deployment.ID) require.True(t, ok) - assert.Equal(t, d.Version, testutil.DefaultDeploymentVersion[:]) + assert.Equal(t, d.Hash, testutil.DefaultDeploymentHash[:]) }) // Change the version - depSum := sha256.Sum256(testutil.DefaultDeploymentVersion[:]) + depSum := sha256.Sum256(testutil.DefaultDeploymentHash[:]) - msgUpdate := &types.MsgUpdateDeployment{ - ID: msg.ID, - Version: depSum[:], + msgUpdate := &v1beta4.MsgUpdateDeployment{ + ID: msg.ID, + Hash: depSum[:], } res, err = suite.handler(suite.ctx, msgUpdate) require.NoError(t, err) @@ -238,16 +232,16 @@ func TestUpdateDeploymentExisting(t *testing.T) { t.Run("ensure event created", func(t *testing.T) { t.Skip("now has more events") iev := testutil.ParseDeploymentEvent(t, res.Events[1:]) - require.IsType(t, types.EventDeploymentUpdated{}, iev) + require.IsType(t, v1beta4.EventDeploymentUpdated{}, iev) - dev := iev.(types.EventDeploymentUpdated) + dev := iev.(v1beta4.EventDeploymentUpdated) require.Equal(t, msg.ID, dev.ID) }) t.Run("assert version updated", func(t *testing.T) { - d, ok := suite.dkeeper.GetDeployment(suite.ctx, deployment.DeploymentID) + d, ok := suite.dkeeper.GetDeployment(suite.ctx, deployment.ID) require.True(t, ok) - assert.Equal(t, d.Version, depSum[:]) + assert.Equal(t, d.Hash, depSum[:]) }) // Run the same update, should fail since nothing is different @@ -262,13 +256,13 @@ func TestCloseDeploymentNonExisting(t *testing.T) { deployment := testutil.Deployment(suite.t) - msg := &types.MsgCloseDeployment{ - ID: deployment.ID(), + msg := &v1beta4.MsgCloseDeployment{ + ID: deployment.ID, } res, err := suite.handler(suite.ctx, msg) require.Nil(t, res) - require.EqualError(t, err, types.ErrDeploymentNotFound.Error()) + require.EqualError(t, err, v1.ErrDeploymentNotFound.Error()) } func TestCloseDeploymentExisting(t *testing.T) { @@ -276,11 +270,11 @@ func TestCloseDeploymentExisting(t *testing.T) { deployment, groups := suite.createDeployment() - msg := &types.MsgCreateDeployment{ - ID: deployment.ID(), - Groups: make([]types.GroupSpec, 0, len(groups)), + msg := &v1beta4.MsgCreateDeployment{ + ID: deployment.ID, + Groups: make(v1beta4.GroupSpecs, 0, len(groups)), Deposit: suite.defaultDeposit, - Depositor: deployment.ID().Owner, + Depositor: deployment.ID.Owner, } for _, group := range groups { @@ -294,15 +288,15 @@ func TestCloseDeploymentExisting(t *testing.T) { t.Run("ensure event created", func(t *testing.T) { t.Skip("now has more events") iev := testutil.ParseDeploymentEvent(t, res.Events) - require.IsType(t, types.EventDeploymentCreated{}, iev) + require.IsType(t, v1beta4.EventDeploymentCreated{}, iev) - dev := iev.(types.EventDeploymentCreated) + dev := iev.(v1beta4.EventDeploymentCreated) require.Equal(t, msg.ID, dev.ID) }) - msgClose := &types.MsgCloseDeployment{ - ID: deployment.ID(), + msgClose := &v1beta4.MsgCloseDeployment{ + ID: deployment.ID, } res, err = suite.handler(suite.ctx, msgClose) @@ -312,9 +306,9 @@ func TestCloseDeploymentExisting(t *testing.T) { t.Run("ensure event updated", func(t *testing.T) { t.Skip("now has more events") iev := testutil.ParseDeploymentEvent(t, res.Events[1:2]) - require.IsType(t, types.EventDeploymentUpdated{}, iev) + require.IsType(t, v1beta4.EventDeploymentUpdated{}, iev) - dev := iev.(types.EventDeploymentUpdated) + dev := iev.(v1beta4.EventDeploymentUpdated) require.Equal(t, msg.ID, dev.ID) }) @@ -322,16 +316,16 @@ func TestCloseDeploymentExisting(t *testing.T) { t.Run("ensure event close", func(t *testing.T) { t.Skip("now has more events") iev := testutil.ParseDeploymentEvent(t, res.Events[2:]) - require.IsType(t, types.EventDeploymentClosed{}, iev) + require.IsType(t, v1beta4.EventDeploymentClosed{}, iev) - dev := iev.(types.EventDeploymentClosed) + dev := iev.(v1beta4.EventDeploymentClosed) require.Equal(t, msg.ID, dev.ID) }) res, err = suite.handler(suite.ctx, msgClose) require.Nil(t, res) - require.EqualError(t, err, types.ErrDeploymentClosed.Error()) + require.EqualError(t, err, v1.ErrDeploymentClosed.Error()) } func TestFundedDeployment(t *testing.T) { @@ -340,9 +334,9 @@ func TestFundedDeployment(t *testing.T) { deployment, groups := suite.createDeployment() // create a funded deployment - msg := &types.MsgCreateDeployment{ - ID: deployment.ID(), - Groups: make([]types.GroupSpec, 0, len(groups)), + msg := &v1beta4.MsgCreateDeployment{ + ID: deployment.ID, + Groups: make(v1beta4.GroupSpecs, 0, len(groups)), Deposit: suite.defaultDeposit, Depositor: suite.depositor, } @@ -356,23 +350,23 @@ func TestFundedDeployment(t *testing.T) { require.NotNil(t, res) // ensure that it got created - _, exists := suite.dkeeper.GetDeployment(suite.ctx, deployment.ID()) + _, exists := suite.dkeeper.GetDeployment(suite.ctx, deployment.ID) require.True(t, exists) // ensure that the escrow account has correct state - accID := types.EscrowAccountForDeployment(deployment.ID()) + accID := v1beta4.EscrowAccountForDeployment(deployment.ID) acc, err := suite.EscrowKeeper().GetAccount(suite.ctx, accID) require.NoError(t, err) - require.Equal(t, deployment.ID().Owner, acc.Owner) + require.Equal(t, deployment.ID.Owner, acc.Owner) require.Equal(t, suite.depositor, acc.Depositor) require.Equal(t, sdk.NewDecCoin(msg.Deposit.Denom, sdk.ZeroInt()), acc.Balance) require.Equal(t, sdk.NewDecCoinFromCoin(msg.Deposit), acc.Funds) // deposit additional amount from the owner - depositMsg := &types.MsgDepositDeployment{ - ID: deployment.ID(), + depositMsg := &v1.MsgDepositDeployment{ + ID: deployment.ID, Amount: suite.defaultDeposit, - Depositor: deployment.ID().Owner, + Depositor: deployment.ID.Owner, } res, err = suite.handler(suite.ctx, depositMsg) require.NoError(t, err) @@ -381,14 +375,14 @@ func TestFundedDeployment(t *testing.T) { // ensure that the escrow account's state gets updated correctly acc, err = suite.EscrowKeeper().GetAccount(suite.ctx, accID) require.NoError(t, err) - require.Equal(t, deployment.ID().Owner, acc.Owner) + require.Equal(t, deployment.ID.Owner, acc.Owner) require.Equal(t, suite.depositor, acc.Depositor) require.Equal(t, sdk.NewDecCoinFromCoin(depositMsg.Amount), acc.Balance) require.Equal(t, sdk.NewDecCoinFromCoin(msg.Deposit), acc.Funds) // deposit additional amount from the depositor - depositMsg1 := &types.MsgDepositDeployment{ - ID: deployment.ID(), + depositMsg1 := &v1.MsgDepositDeployment{ + ID: deployment.ID, Amount: suite.defaultDeposit, Depositor: suite.depositor, } @@ -399,14 +393,14 @@ func TestFundedDeployment(t *testing.T) { // ensure that the escrow account's state gets updated correctly acc, err = suite.EscrowKeeper().GetAccount(suite.ctx, accID) require.NoError(t, err) - require.Equal(t, deployment.ID().Owner, acc.Owner) + require.Equal(t, deployment.ID.Owner, acc.Owner) require.Equal(t, suite.depositor, acc.Depositor) require.Equal(t, sdk.NewDecCoinFromCoin(depositMsg.Amount), acc.Balance) require.Equal(t, sdk.NewDecCoinFromCoin(msg.Deposit.Add(depositMsg1.Amount)), acc.Funds) // depositing additional amount from a random depositor should fail - depositMsg2 := &types.MsgDepositDeployment{ - ID: deployment.ID(), + depositMsg2 := &v1.MsgDepositDeployment{ + ID: deployment.ID, Amount: suite.defaultDeposit, Depositor: testutil.AccAddress(t).String(), } @@ -429,7 +423,7 @@ func TestFundedDeployment(t *testing.T) { require.Equal(t, sdk.NewDecCoin(msg.Deposit.Denom, suite.defaultDeposit.Amount), acc.Funds) // close the deployment - closeMsg := &types.MsgCloseDeployment{ID: deployment.ID()} + closeMsg := &v1beta4.MsgCloseDeployment{ID: deployment.ID} res, err = suite.handler(ctx, closeMsg) require.NoError(t, err) require.NotNil(t, res) @@ -441,24 +435,24 @@ func TestFundedDeployment(t *testing.T) { require.Equal(t, sdk.NewDecCoin(msg.Deposit.Denom, sdk.ZeroInt()), acc.Funds) } -func (st *testSuite) createDeployment() (types.Deployment, []types.Group) { +func (st *testSuite) createDeployment() (v1.Deployment, v1beta4.Groups) { st.t.Helper() deployment := testutil.Deployment(st.t) - group := testutil.DeploymentGroup(st.t, deployment.ID(), 0) - group.GroupSpec.Resources = types.ResourceUnits{ + group := testutil.DeploymentGroup(st.t, deployment.ID, 0) + group.GroupSpec.Resources = v1beta4.ResourceUnits{ { Resources: testutil.ResourceUnits(st.t), Count: 1, Price: testutil.AkashDecCoinRandom(st.t), }, } - groups := []types.Group{ + groups := v1beta4.Groups{ group, } for i := range groups { - groups[i].State = types.GroupOpen + groups[i].State = v1beta4.GroupOpen } return deployment, groups diff --git a/x/deployment/handler/keepers.go b/x/deployment/handler/keepers.go index fa0e76470c..f24640f939 100644 --- a/x/deployment/handler/keepers.go +++ b/x/deployment/handler/keepers.go @@ -6,16 +6,16 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" + etypes "pkg.akt.dev/go/node/escrow/v1" + mtypes "pkg.akt.dev/go/node/market/v1beta5" ) // MarketKeeper Interface includes market methods type MarketKeeper interface { - CreateOrder(ctx sdk.Context, id types.GroupID, spec types.GroupSpec) (mtypes.Order, error) - OnGroupClosed(ctx sdk.Context, id types.GroupID) + CreateOrder(ctx sdk.Context, id types.GroupID, spec v1beta4.GroupSpec) (mtypes.Order, error) + OnGroupClosed(ctx sdk.Context, id types.GroupID) error } type EscrowKeeper interface { @@ -28,6 +28,6 @@ type EscrowKeeper interface { //go:generate mockery --name AuthzKeeper --output ./mocks type AuthzKeeper interface { DeleteGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) error - GetCleanAuthorization(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) (cap authz.Authorization, expiration time.Time) - SaveGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration time.Time) error + GetAuthorization(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) (authz.Authorization, *time.Time) + SaveGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration *time.Time) error } diff --git a/x/deployment/handler/mocks/authz_keeper.go b/x/deployment/handler/mocks/authz_keeper.go index 2109d51ead..80a99af67d 100644 --- a/x/deployment/handler/mocks/authz_keeper.go +++ b/x/deployment/handler/mocks/authz_keeper.go @@ -74,17 +74,17 @@ func (_c *AuthzKeeper_DeleteGrant_Call) RunAndReturn(run func(types.Context, typ return _c } -// GetCleanAuthorization provides a mock function with given fields: ctx, grantee, granter, msgType -func (_m *AuthzKeeper) GetCleanAuthorization(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) (authz.Authorization, time.Time) { +// GetAuthorization provides a mock function with given fields: ctx, grantee, granter, msgType +func (_m *AuthzKeeper) GetAuthorization(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string) (authz.Authorization, *time.Time) { ret := _m.Called(ctx, grantee, granter, msgType) if len(ret) == 0 { - panic("no return value specified for GetCleanAuthorization") + panic("no return value specified for GetAuthorization") } var r0 authz.Authorization - var r1 time.Time - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, time.Time)); ok { + var r1 *time.Time + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, *time.Time)); ok { return rf(ctx, grantee, granter, msgType) } if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, string) authz.Authorization); ok { @@ -95,48 +95,50 @@ func (_m *AuthzKeeper) GetCleanAuthorization(ctx types.Context, grantee types.Ac } } - if rf, ok := ret.Get(1).(func(types.Context, types.AccAddress, types.AccAddress, string) time.Time); ok { + if rf, ok := ret.Get(1).(func(types.Context, types.AccAddress, types.AccAddress, string) *time.Time); ok { r1 = rf(ctx, grantee, granter, msgType) } else { - r1 = ret.Get(1).(time.Time) + if ret.Get(1) != nil { + r1 = ret.Get(1).(*time.Time) + } } return r0, r1 } -// AuthzKeeper_GetCleanAuthorization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCleanAuthorization' -type AuthzKeeper_GetCleanAuthorization_Call struct { +// AuthzKeeper_GetAuthorization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthorization' +type AuthzKeeper_GetAuthorization_Call struct { *mock.Call } -// GetCleanAuthorization is a helper method to define mock.On call +// GetAuthorization is a helper method to define mock.On call // - ctx types.Context // - grantee types.AccAddress // - granter types.AccAddress // - msgType string -func (_e *AuthzKeeper_Expecter) GetCleanAuthorization(ctx interface{}, grantee interface{}, granter interface{}, msgType interface{}) *AuthzKeeper_GetCleanAuthorization_Call { - return &AuthzKeeper_GetCleanAuthorization_Call{Call: _e.mock.On("GetCleanAuthorization", ctx, grantee, granter, msgType)} +func (_e *AuthzKeeper_Expecter) GetAuthorization(ctx interface{}, grantee interface{}, granter interface{}, msgType interface{}) *AuthzKeeper_GetAuthorization_Call { + return &AuthzKeeper_GetAuthorization_Call{Call: _e.mock.On("GetAuthorization", ctx, grantee, granter, msgType)} } -func (_c *AuthzKeeper_GetCleanAuthorization_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string)) *AuthzKeeper_GetCleanAuthorization_Call { +func (_c *AuthzKeeper_GetAuthorization_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, msgType string)) *AuthzKeeper_GetAuthorization_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(string)) }) return _c } -func (_c *AuthzKeeper_GetCleanAuthorization_Call) Return(cap authz.Authorization, expiration time.Time) *AuthzKeeper_GetCleanAuthorization_Call { - _c.Call.Return(cap, expiration) +func (_c *AuthzKeeper_GetAuthorization_Call) Return(_a0 authz.Authorization, _a1 *time.Time) *AuthzKeeper_GetAuthorization_Call { + _c.Call.Return(_a0, _a1) return _c } -func (_c *AuthzKeeper_GetCleanAuthorization_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, time.Time)) *AuthzKeeper_GetCleanAuthorization_Call { +func (_c *AuthzKeeper_GetAuthorization_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, string) (authz.Authorization, *time.Time)) *AuthzKeeper_GetAuthorization_Call { _c.Call.Return(run) return _c } // SaveGrant provides a mock function with given fields: ctx, grantee, granter, authorization, expiration -func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration time.Time) error { +func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration *time.Time) error { ret := _m.Called(ctx, grantee, granter, authorization, expiration) if len(ret) == 0 { @@ -144,7 +146,7 @@ func (_m *AuthzKeeper) SaveGrant(ctx types.Context, grantee types.AccAddress, gr } var r0 error - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, time.Time) error); ok { + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, *time.Time) error); ok { r0 = rf(ctx, grantee, granter, authorization, expiration) } else { r0 = ret.Error(0) @@ -163,14 +165,14 @@ type AuthzKeeper_SaveGrant_Call struct { // - grantee types.AccAddress // - granter types.AccAddress // - authorization authz.Authorization -// - expiration time.Time +// - expiration *time.Time func (_e *AuthzKeeper_Expecter) SaveGrant(ctx interface{}, grantee interface{}, granter interface{}, authorization interface{}, expiration interface{}) *AuthzKeeper_SaveGrant_Call { return &AuthzKeeper_SaveGrant_Call{Call: _e.mock.On("SaveGrant", ctx, grantee, granter, authorization, expiration)} } -func (_c *AuthzKeeper_SaveGrant_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration time.Time)) *AuthzKeeper_SaveGrant_Call { +func (_c *AuthzKeeper_SaveGrant_Call) Run(run func(ctx types.Context, grantee types.AccAddress, granter types.AccAddress, authorization authz.Authorization, expiration *time.Time)) *AuthzKeeper_SaveGrant_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(authz.Authorization), args[4].(time.Time)) + run(args[0].(types.Context), args[1].(types.AccAddress), args[2].(types.AccAddress), args[3].(authz.Authorization), args[4].(*time.Time)) }) return _c } @@ -180,7 +182,7 @@ func (_c *AuthzKeeper_SaveGrant_Call) Return(_a0 error) *AuthzKeeper_SaveGrant_C return _c } -func (_c *AuthzKeeper_SaveGrant_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, time.Time) error) *AuthzKeeper_SaveGrant_Call { +func (_c *AuthzKeeper_SaveGrant_Call) RunAndReturn(run func(types.Context, types.AccAddress, types.AccAddress, authz.Authorization, *time.Time) error) *AuthzKeeper_SaveGrant_Call { _c.Call.Return(run) return _c } diff --git a/x/deployment/handler/server.go b/x/deployment/handler/server.go index 3399abb094..801e9f47c2 100644 --- a/x/deployment/handler/server.go +++ b/x/deployment/handler/server.go @@ -8,9 +8,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + v1 "pkg.akt.dev/go/node/deployment/v1" + types "pkg.akt.dev/go/node/deployment/v1beta4" - "github.com/akash-network/node/x/deployment/keeper" + "pkg.akt.dev/akashd/x/deployment/keeper" ) var _ types.MsgServer = msgServer{} @@ -32,7 +33,7 @@ func (ms msgServer) CreateDeployment(goCtx context.Context, msg *types.MsgCreate ctx := sdk.UnwrapSDKContext(goCtx) if _, found := ms.deployment.GetDeployment(ctx, msg.ID); found { - return nil, types.ErrDeploymentExists + return nil, v1.ErrDeploymentExists } params := ms.deployment.GetParams(ctx) @@ -40,15 +41,15 @@ func (ms msgServer) CreateDeployment(goCtx context.Context, msg *types.MsgCreate return nil, err } - deployment := types.Deployment{ - DeploymentID: msg.ID, - State: types.DeploymentActive, - Version: msg.Version, - CreatedAt: ctx.BlockHeight(), + deployment := v1.Deployment{ + ID: msg.ID, + State: v1.DeploymentActive, + Hash: msg.Hash, + CreatedAt: ctx.BlockHeight(), } if err := types.ValidateDeploymentGroups(msg.Groups); err != nil { - return nil, fmt.Errorf("%w: %s", types.ErrInvalidGroups, err.Error()) + return nil, fmt.Errorf("%w: %s", v1.ErrInvalidGroups, err.Error()) } owner, err := sdk.AccAddressFromBech32(msg.ID.Owner) @@ -69,7 +70,7 @@ func (ms msgServer) CreateDeployment(goCtx context.Context, msg *types.MsgCreate for idx, spec := range msg.Groups { groups = append(groups, types.Group{ - GroupID: types.MakeGroupID(deployment.ID(), uint32(idx+1)), + ID: v1.MakeGroupID(deployment.ID, uint32(idx+1)), State: types.GroupOpen, GroupSpec: spec, CreatedAt: ctx.BlockHeight(), @@ -77,18 +78,18 @@ func (ms msgServer) CreateDeployment(goCtx context.Context, msg *types.MsgCreate } if err := ms.deployment.Create(ctx, deployment, groups); err != nil { - return nil, fmt.Errorf("%w: %s", types.ErrInternal, err.Error()) + return nil, fmt.Errorf("%w: %s", v1.ErrInternal, err.Error()) } // create orders for _, group := range groups { - if _, err := ms.market.CreateOrder(ctx, group.ID(), group.GroupSpec); err != nil { + if _, err := ms.market.CreateOrder(ctx, group.ID, group.GroupSpec); err != nil { return &types.MsgCreateDeploymentResponse{}, err } } if err := ms.escrow.AccountCreate(ctx, - types.EscrowAccountForDeployment(deployment.ID()), + types.EscrowAccountForDeployment(deployment.ID), owner, depositor, msg.Deposit, @@ -107,8 +108,8 @@ func (ms msgServer) authorizeDeposit(ctx sdk.Context, owner, depositor sdk.AccAd // find the DepositDeploymentAuthorization given to the owner by the depositor and check // acceptance - msg := &types.MsgDepositDeployment{Amount: deposit} - authorization, expiration := ms.authzKeeper.GetCleanAuthorization(ctx, owner, depositor, sdk.MsgTypeURL(msg)) + msg := &v1.MsgDepositDeployment{Amount: deposit} + authorization, expiration := ms.authzKeeper.GetAuthorization(ctx, owner, depositor, sdk.MsgTypeURL(msg)) if authorization == nil { return sdkerrors.ErrUnauthorized.Wrap("authorization not found") } @@ -134,38 +135,38 @@ func (ms msgServer) authorizeDeposit(ctx sdk.Context, owner, depositor sdk.AccAd return nil } -func (ms msgServer) DepositDeployment(goCtx context.Context, msg *types.MsgDepositDeployment) (*types.MsgDepositDeploymentResponse, error) { +func (ms msgServer) DepositDeployment(goCtx context.Context, msg *v1.MsgDepositDeployment) (*v1.MsgDepositDeploymentResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) deployment, found := ms.deployment.GetDeployment(ctx, msg.ID) if !found { - return &types.MsgDepositDeploymentResponse{}, types.ErrDeploymentNotFound + return &v1.MsgDepositDeploymentResponse{}, v1.ErrDeploymentNotFound } - if deployment.State != types.DeploymentActive { - return &types.MsgDepositDeploymentResponse{}, types.ErrDeploymentClosed + if deployment.State != v1.DeploymentActive { + return &v1.MsgDepositDeploymentResponse{}, v1.ErrDeploymentClosed } - owner, err := sdk.AccAddressFromBech32(deployment.ID().Owner) + owner, err := sdk.AccAddressFromBech32(deployment.ID.Owner) if err != nil { - return &types.MsgDepositDeploymentResponse{}, err + return &v1.MsgDepositDeploymentResponse{}, err } depositor, err := sdk.AccAddressFromBech32(msg.Depositor) if err != nil { - return &types.MsgDepositDeploymentResponse{}, err + return &v1.MsgDepositDeploymentResponse{}, err } eID := types.EscrowAccountForDeployment(msg.ID) eAccount, err := ms.escrow.GetAccount(ctx, eID) if err != nil { - return &types.MsgDepositDeploymentResponse{}, err + return &v1.MsgDepositDeploymentResponse{}, err } // error if depositor is not an owner and there is already exists authorization from another account if (msg.Depositor != msg.ID.Owner) && eAccount.HasDepositor() && (eAccount.Depositor != msg.Depositor) { - return &types.MsgDepositDeploymentResponse{}, types.ErrInvalidDeploymentDepositor + return &v1.MsgDepositDeploymentResponse{}, v1.ErrInvalidDeploymentDepositor } if err = ms.authorizeDeposit(ctx, owner, depositor, msg.Amount); err != nil { @@ -176,10 +177,10 @@ func (ms msgServer) DepositDeployment(goCtx context.Context, msg *types.MsgDepos eID, depositor, msg.Amount); err != nil { - return &types.MsgDepositDeploymentResponse{}, err + return &v1.MsgDepositDeploymentResponse{}, err } - return &types.MsgDepositDeploymentResponse{}, nil + return &v1.MsgDepositDeploymentResponse{}, nil } func (ms msgServer) UpdateDeployment(goCtx context.Context, msg *types.MsgUpdateDeployment) (*types.MsgUpdateDeploymentResponse, error) { @@ -187,23 +188,23 @@ func (ms msgServer) UpdateDeployment(goCtx context.Context, msg *types.MsgUpdate deployment, found := ms.deployment.GetDeployment(ctx, msg.ID) if !found { - return nil, types.ErrDeploymentNotFound + return nil, v1.ErrDeploymentNotFound } // If the deployment is not active, do not allow it to be updated - if deployment.State != types.DeploymentActive { - return &types.MsgUpdateDeploymentResponse{}, types.ErrDeploymentClosed + if deployment.State != v1.DeploymentActive { + return &types.MsgUpdateDeploymentResponse{}, v1.ErrDeploymentClosed } // If the version is not identical do not allow the update, there is nothing to change in this transaction - if bytes.Equal(msg.Version, deployment.Version) { - return &types.MsgUpdateDeploymentResponse{}, types.ErrInvalidVersion + if bytes.Equal(msg.Hash, deployment.Hash) { + return &types.MsgUpdateDeploymentResponse{}, v1.ErrInvalidHash } - deployment.Version = msg.Version + deployment.Hash = msg.Hash if err := ms.deployment.UpdateDeployment(ctx, deployment); err != nil { - return &types.MsgUpdateDeploymentResponse{}, fmt.Errorf("%w: %s", types.ErrInternal, err.Error()) + return &types.MsgUpdateDeploymentResponse{}, fmt.Errorf("%w: %s", v1.ErrInternal, err.Error()) } return &types.MsgUpdateDeploymentResponse{}, nil @@ -214,15 +215,15 @@ func (ms msgServer) CloseDeployment(goCtx context.Context, msg *types.MsgCloseDe deployment, found := ms.deployment.GetDeployment(ctx, msg.ID) if !found { - return &types.MsgCloseDeploymentResponse{}, types.ErrDeploymentNotFound + return &types.MsgCloseDeploymentResponse{}, v1.ErrDeploymentNotFound } - if deployment.State != types.DeploymentActive { - return &types.MsgCloseDeploymentResponse{}, types.ErrDeploymentClosed + if deployment.State != v1.DeploymentActive { + return &types.MsgCloseDeploymentResponse{}, v1.ErrDeploymentClosed } if err := ms.escrow.AccountClose(ctx, - types.EscrowAccountForDeployment(deployment.ID()), + types.EscrowAccountForDeployment(deployment.ID), ); err != nil { return &types.MsgCloseDeploymentResponse{}, err } @@ -237,7 +238,7 @@ func (ms msgServer) CloseGroup(goCtx context.Context, msg *types.MsgCloseGroup) group, found := ms.deployment.GetGroup(ctx, msg.ID) if !found { - return nil, types.ErrGroupNotFound + return nil, v1.ErrGroupNotFound } // if Group already closed; return the validation error @@ -251,7 +252,7 @@ func (ms msgServer) CloseGroup(goCtx context.Context, msg *types.MsgCloseGroup) if err != nil { return nil, err } - ms.market.OnGroupClosed(ctx, group.ID()) + ms.market.OnGroupClosed(ctx, group.ID) return &types.MsgCloseGroupResponse{}, nil } @@ -261,7 +262,7 @@ func (ms msgServer) PauseGroup(goCtx context.Context, msg *types.MsgPauseGroup) group, found := ms.deployment.GetGroup(ctx, msg.ID) if !found { - return nil, types.ErrGroupNotFound + return nil, v1.ErrGroupNotFound } // if Group already closed; return the validation error @@ -275,7 +276,7 @@ func (ms msgServer) PauseGroup(goCtx context.Context, msg *types.MsgPauseGroup) if err != nil { return nil, err } - ms.market.OnGroupClosed(ctx, group.ID()) + ms.market.OnGroupClosed(ctx, group.ID) return &types.MsgPauseGroupResponse{}, nil } @@ -285,7 +286,7 @@ func (ms msgServer) StartGroup(goCtx context.Context, msg *types.MsgStartGroup) group, found := ms.deployment.GetGroup(ctx, msg.ID) if !found { - return &types.MsgStartGroupResponse{}, types.ErrGroupNotFound + return &types.MsgStartGroupResponse{}, v1.ErrGroupNotFound } err := group.ValidateStartable() @@ -297,7 +298,7 @@ func (ms msgServer) StartGroup(goCtx context.Context, msg *types.MsgStartGroup) if err != nil { return &types.MsgStartGroupResponse{}, err } - if _, err := ms.market.CreateOrder(ctx, group.ID(), group.GroupSpec); err != nil { + if _, err := ms.market.CreateOrder(ctx, group.ID, group.GroupSpec); err != nil { return &types.MsgStartGroupResponse{}, err } diff --git a/x/deployment/keeper/external.go b/x/deployment/keeper/external.go index 66a4f84fac..b4fbfba0c9 100644 --- a/x/deployment/keeper/external.go +++ b/x/deployment/keeper/external.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + etypes "pkg.akt.dev/go/node/escrow/v1" ) type EscrowKeeper interface { diff --git a/x/deployment/keeper/grpc_query.go b/x/deployment/keeper/grpc_query.go index 07e70733ea..082a29db78 100644 --- a/x/deployment/keeper/grpc_query.go +++ b/x/deployment/keeper/grpc_query.go @@ -11,7 +11,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + "pkg.akt.dev/go/node/deployment/v1" + types "pkg.akt.dev/go/node/deployment/v1beta4" ) // Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper @@ -27,9 +28,9 @@ func (k Querier) Deployments(c context.Context, req *types.QueryDeploymentsReque return nil, status.Error(codes.InvalidArgument, "empty request") } - stateVal := types.Deployment_State(types.Deployment_State_value[req.Filters.State]) + stateVal := v1.DeploymentState(v1.DeploymentState_value[req.Filters.State]) - if req.Filters.State != "" && stateVal == types.DeploymentStateInvalid { + if req.Filters.State != "" && stateVal == v1.DeploymentStateInvalid { return nil, status.Error(codes.InvalidArgument, "invalid state value") } @@ -44,7 +45,7 @@ func (k Querier) Deployments(c context.Context, req *types.QueryDeploymentsReque depStore := prefix.NewStore(ctx.KVStore(k.skey), searchPrefix) pageRes, err := sdkquery.FilteredPaginate(depStore, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { - var deployment types.Deployment + var deployment v1.Deployment err := k.cdc.Unmarshal(value, &deployment) if err != nil { @@ -57,15 +58,15 @@ func (k Querier) Deployments(c context.Context, req *types.QueryDeploymentsReque account, err := k.ekeeper.GetAccount( ctx, - types.EscrowAccountForDeployment(deployment.ID()), + types.EscrowAccountForDeployment(deployment.ID), ) if err != nil { - return true, fmt.Errorf("%w: fetching escrow account for DeploymentID=%s", err, deployment.DeploymentID) + return true, fmt.Errorf("%w: fetching escrow account for DeploymentID=%s", err, deployment.ID) } value := types.QueryDeploymentResponse{ Deployment: deployment, - Groups: k.GetGroups(ctx, deployment.ID()), + Groups: k.GetGroups(ctx, deployment.ID), EscrowAccount: account, } @@ -101,7 +102,7 @@ func (k Querier) Deployment(c context.Context, req *types.QueryDeploymentRequest deployment, found := k.GetDeployment(ctx, req.ID) if !found { - return nil, types.ErrDeploymentNotFound + return nil, v1.ErrDeploymentNotFound } account, err := k.ekeeper.GetAccount( @@ -135,7 +136,7 @@ func (k Querier) Group(c context.Context, req *types.QueryGroupRequest) (*types. group, found := k.GetGroup(ctx, req.ID) if !found { - return nil, types.ErrGroupNotFound + return nil, v1.ErrGroupNotFound } return &types.QueryGroupResponse{Group: group}, nil diff --git a/x/deployment/keeper/grpc_query_test.go b/x/deployment/keeper/grpc_query_test.go index 08df49cd44..7f6a31b40d 100644 --- a/x/deployment/keeper/grpc_query_test.go +++ b/x/deployment/keeper/grpc_query_test.go @@ -7,21 +7,21 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" + etypes "pkg.akt.dev/go/node/escrow/v1" - "github.com/akash-network/node/app" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/deployment/keeper" - ekeeper "github.com/akash-network/node/x/escrow/keeper" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/deployment/keeper" + ekeeper "pkg.akt.dev/akashd/x/escrow/keeper" ) type grpcTestSuite struct { @@ -31,7 +31,7 @@ type grpcTestSuite struct { keeper keeper.IKeeper ekeeper ekeeper.Keeper - queryClient types.QueryClient + queryClient v1beta4.QueryClient } func setupTest(t *testing.T) *grpcTestSuite { @@ -47,8 +47,8 @@ func setupTest(t *testing.T) *grpcTestSuite { querier := suite.keeper.NewQuerier() queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, querier) - suite.queryClient = types.NewQueryClient(queryHelper) + v1beta4.RegisterQueryServer(queryHelper, querier) + suite.queryClient = v1beta4.NewQueryClient(queryHelper) return suite } @@ -61,11 +61,11 @@ func TestGRPCQueryDeployment(t *testing.T) { err := suite.keeper.Create(suite.ctx, deployment, groups) require.NoError(t, err) - eid := suite.createEscrowAccount(deployment.ID()) + eid := suite.createEscrowAccount(deployment.ID) var ( - req *types.QueryDeploymentRequest - expDeployment types.QueryDeploymentResponse + req *v1beta4.QueryDeploymentRequest + expDeployment v1beta4.QueryDeploymentResponse ) testCases := []struct { @@ -76,21 +76,21 @@ func TestGRPCQueryDeployment(t *testing.T) { { "empty request", func() { - req = &types.QueryDeploymentRequest{} + req = &v1beta4.QueryDeploymentRequest{} }, false, }, { "invalid request", func() { - req = &types.QueryDeploymentRequest{ID: types.DeploymentID{}} + req = &v1beta4.QueryDeploymentRequest{ID: v1.DeploymentID{}} }, false, }, { "deployment not found", func() { - req = &types.QueryDeploymentRequest{ID: types.DeploymentID{ + req = &v1beta4.QueryDeploymentRequest{ID: v1.DeploymentID{ Owner: testutil.AccAddress(t).String(), DSeq: 32, }} @@ -100,8 +100,8 @@ func TestGRPCQueryDeployment(t *testing.T) { { "success", func() { - req = &types.QueryDeploymentRequest{ID: deployment.DeploymentID} - expDeployment = types.QueryDeploymentResponse{ + req = &v1beta4.QueryDeploymentRequest{ID: deployment.ID} + expDeployment = v1beta4.QueryDeploymentResponse{ Deployment: deployment, Groups: groups, } @@ -140,15 +140,15 @@ func TestGRPCQueryDeployments(t *testing.T) { deployment, groups := suite.createDeployment() err := suite.keeper.Create(suite.ctx, deployment, groups) require.NoError(t, err) - suite.createEscrowAccount(deployment.ID()) + suite.createEscrowAccount(deployment.ID) deployment2, groups2 := suite.createDeployment() - deployment2.State = types.DeploymentClosed + deployment2.State = v1.DeploymentClosed err = suite.keeper.Create(suite.ctx, deployment2, groups2) require.NoError(t, err) - suite.createEscrowAccount(deployment2.ID()) + suite.createEscrowAccount(deployment2.ID) - var req *types.QueryDeploymentsRequest + var req *v1beta4.QueryDeploymentsRequest testCases := []struct { msg string @@ -158,17 +158,17 @@ func TestGRPCQueryDeployments(t *testing.T) { { "query deployments without any filters and pagination", func() { - req = &types.QueryDeploymentsRequest{} + req = &v1beta4.QueryDeploymentsRequest{} }, 2, }, { "query deployments with filters having non existent data", func() { - req = &types.QueryDeploymentsRequest{ - Filters: types.DeploymentFilters{ + req = &v1beta4.QueryDeploymentsRequest{ + Filters: v1beta4.DeploymentFilters{ DSeq: 37, - State: types.DeploymentClosed.String(), + State: v1.DeploymentClosed.String(), }} }, 0, @@ -176,14 +176,14 @@ func TestGRPCQueryDeployments(t *testing.T) { { "query deployments with state filter", func() { - req = &types.QueryDeploymentsRequest{Filters: types.DeploymentFilters{State: types.DeploymentClosed.String()}} + req = &v1beta4.QueryDeploymentsRequest{Filters: v1beta4.DeploymentFilters{State: v1.DeploymentClosed.String()}} }, 1, }, { "query deployments with pagination", func() { - req = &types.QueryDeploymentsRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} + req = &v1beta4.QueryDeploymentsRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} }, 1, }, @@ -206,8 +206,8 @@ func TestGRPCQueryDeployments(t *testing.T) { type deploymentFilterModifier struct { fieldName string - f func(leaseID types.DeploymentID, filter types.DeploymentFilters) types.DeploymentFilters - getField func(leaseID types.DeploymentID) interface{} + f func(leaseID v1.DeploymentID, filter v1beta4.DeploymentFilters) v1beta4.DeploymentFilters + getField func(leaseID v1.DeploymentID) interface{} } func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { @@ -222,7 +222,7 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { suite.createEscrowAccount(depB) suite.createEscrowAccount(depC) - deps := []types.DeploymentID{ + deps := []v1.DeploymentID{ depA, depB, depC, @@ -231,21 +231,21 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { modifiers := []deploymentFilterModifier{ { "owner", - func(depID types.DeploymentID, filter types.DeploymentFilters) types.DeploymentFilters { + func(depID v1.DeploymentID, filter v1beta4.DeploymentFilters) v1beta4.DeploymentFilters { filter.Owner = depID.GetOwner() return filter }, - func(depID types.DeploymentID) interface{} { + func(depID v1.DeploymentID) interface{} { return depID.Owner }, }, { "dseq", - func(depID types.DeploymentID, filter types.DeploymentFilters) types.DeploymentFilters { + func(depID v1.DeploymentID, filter v1beta4.DeploymentFilters) v1beta4.DeploymentFilters { filter.DSeq = depID.DSeq return filter }, - func(depID types.DeploymentID) interface{} { + func(depID v1.DeploymentID) interface{} { return depID.DSeq }, }, @@ -255,8 +255,8 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { for _, depID := range deps { for _, m := range modifiers { - req := &types.QueryDeploymentsRequest{ - Filters: m.f(depID, types.DeploymentFilters{}), + req := &v1beta4.QueryDeploymentsRequest{ + Filters: m.f(depID, v1beta4.DeploymentFilters{}), } res, err := suite.queryClient.Deployments(ctx, req) @@ -267,7 +267,7 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { assert.GreaterOrEqual(t, len(res.Deployments), 1, "testing %v", m.fieldName) for _, dep := range res.Deployments { - assert.Equal(t, m.getField(depID), m.getField(dep.Deployment.DeploymentID), "testing %v", m.fieldName) + assert.Equal(t, m.getField(depID), m.getField(dep.Deployment.ID), "testing %v", m.fieldName) } } } @@ -275,7 +275,7 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { limit := int(math.Pow(2, float64(len(modifiers)))) // Use an order ID that matches absolutely nothing in any field - bogusOrderID := types.DeploymentID{ + bogusOrderID := v1.DeploymentID{ Owner: testutil.AccAddress(t).String(), DSeq: 9999999, } @@ -289,7 +289,7 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { } for _, orderID := range deps { - filter := types.DeploymentFilters{} + filter := v1beta4.DeploymentFilters{} msg := strings.Builder{} msg.WriteString("testing filtering on: ") for k, useModifier := range modifiersToUse { @@ -302,7 +302,7 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryDeploymentsRequest{ + req := &v1beta4.QueryDeploymentsRequest{ Filters: filter, } @@ -319,12 +319,12 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { continue } m := modifiers[k] - require.Equal(t, m.getField(orderID), m.getField(dep.Deployment.DeploymentID), "testing %v", m.fieldName) + require.Equal(t, m.getField(orderID), m.getField(dep.Deployment.ID), "testing %v", m.fieldName) } } } - filter := types.DeploymentFilters{} + filter := v1beta4.DeploymentFilters{} msg := strings.Builder{} msg.WriteString("testing filtering on (using non matching ID): ") for k, useModifier := range modifiersToUse { @@ -337,7 +337,7 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryDeploymentsRequest{ + req := &v1beta4.QueryDeploymentsRequest{ Filters: filter, } @@ -354,8 +354,8 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { for _, depID := range deps { // Query by owner - req := &types.QueryDeploymentsRequest{ - Filters: types.DeploymentFilters{ + req := &v1beta4.QueryDeploymentsRequest{ + Filters: v1beta4.DeploymentFilters{ Owner: depID.Owner, }, } @@ -367,11 +367,11 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { // Just 1 result require.Len(t, res.Deployments, 1) depResult := res.Deployments[0] - require.Equal(t, depID, depResult.GetDeployment().DeploymentID) + require.Equal(t, depID, depResult.GetDeployment().ID) // Query with valid DSeq - req = &types.QueryDeploymentsRequest{ - Filters: types.DeploymentFilters{ + req = &v1beta4.QueryDeploymentsRequest{ + Filters: v1beta4.DeploymentFilters{ Owner: depID.Owner, DSeq: depID.DSeq, }, @@ -384,11 +384,11 @@ func TestGRPCQueryDeploymentsWithFilter(t *testing.T) { require.NotNil(t, res) require.Len(t, res.Deployments, 1) depResult = res.Deployments[0] - require.Equal(t, depID, depResult.Deployment.DeploymentID) + require.Equal(t, depID, depResult.Deployment.ID) // Query with a bogus DSeq - req = &types.QueryDeploymentsRequest{ - Filters: types.DeploymentFilters{ + req = &v1beta4.QueryDeploymentsRequest{ + Filters: v1beta4.DeploymentFilters{ Owner: depID.Owner, DSeq: depID.DSeq + 1, }, @@ -412,8 +412,8 @@ func TestGRPCQueryGroup(t *testing.T) { require.NoError(t, err) var ( - req *types.QueryGroupRequest - expDeployment types.Group + req *v1beta4.QueryGroupRequest + expDeployment v1beta4.Group ) testCases := []struct { @@ -424,21 +424,21 @@ func TestGRPCQueryGroup(t *testing.T) { { "empty request", func() { - req = &types.QueryGroupRequest{} + req = &v1beta4.QueryGroupRequest{} }, false, }, { "invalid request", func() { - req = &types.QueryGroupRequest{ID: types.GroupID{}} + req = &v1beta4.QueryGroupRequest{ID: v1.GroupID{}} }, false, }, { "group not found", func() { - req = &types.QueryGroupRequest{ID: types.GroupID{ + req = &v1beta4.QueryGroupRequest{ID: v1.GroupID{ Owner: testutil.AccAddress(t).String(), DSeq: 32, GSeq: 45, @@ -449,7 +449,7 @@ func TestGRPCQueryGroup(t *testing.T) { { "success", func() { - req = &types.QueryGroupRequest{ID: groups[0].GroupID} + req = &v1beta4.QueryGroupRequest{ID: groups[0].ID} expDeployment = groups[0] }, true, @@ -477,35 +477,35 @@ func TestGRPCQueryGroup(t *testing.T) { } } -func (suite *grpcTestSuite) createDeployment() (types.Deployment, []types.Group) { +func (suite *grpcTestSuite) createDeployment() (v1.Deployment, v1beta4.Groups) { suite.t.Helper() deployment := testutil.Deployment(suite.t) - group := testutil.DeploymentGroup(suite.t, deployment.ID(), 0) - group.GroupSpec.Resources = types.ResourceUnits{ + group := testutil.DeploymentGroup(suite.t, deployment.ID, 0) + group.GroupSpec.Resources = v1beta4.ResourceUnits{ { Resources: testutil.ResourceUnits(suite.t), Count: 1, Price: testutil.DecCoin(suite.t), }, } - groups := []types.Group{ + groups := []v1beta4.Group{ group, } for i := range groups { - groups[i].State = types.GroupOpen + groups[i].State = v1beta4.GroupOpen } return deployment, groups } -func (suite *grpcTestSuite) createEscrowAccount(id types.DeploymentID) etypes.AccountID { +func (suite *grpcTestSuite) createEscrowAccount(id v1.DeploymentID) etypes.AccountID { owner, err := sdk.AccAddressFromBech32(id.Owner) require.NoError(suite.t, err) - eid := types.EscrowAccountForDeployment(id) - defaultDeposit, err := types.DefaultParams().MinDepositFor("uakt") + eid := v1beta4.EscrowAccountForDeployment(id) + defaultDeposit, err := v1beta4.DefaultParams().MinDepositFor("uakt") require.NoError(suite.t, err) err = suite.ekeeper.AccountCreate(suite.ctx, diff --git a/x/deployment/keeper/keeper.go b/x/deployment/keeper/keeper.go index 6368f14809..3307a56a8e 100644 --- a/x/deployment/keeper/keeper.go +++ b/x/deployment/keeper/keeper.go @@ -2,46 +2,48 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + "pkg.akt.dev/go/node/deployment/v1" + types "pkg.akt.dev/go/node/deployment/v1beta4" ) type IKeeper interface { - StoreKey() sdk.StoreKey + StoreKey() storetypes.StoreKey Codec() codec.BinaryCodec - GetDeployment(ctx sdk.Context, id types.DeploymentID) (types.Deployment, bool) - GetGroup(ctx sdk.Context, id types.GroupID) (types.Group, bool) - GetGroups(ctx sdk.Context, id types.DeploymentID) []types.Group - Create(ctx sdk.Context, deployment types.Deployment, groups []types.Group) error - UpdateDeployment(ctx sdk.Context, deployment types.Deployment) error - CloseDeployment(ctx sdk.Context, deployment types.Deployment) - OnCloseGroup(ctx sdk.Context, group types.Group, state types.Group_State) error + GetDeployment(ctx sdk.Context, id v1.DeploymentID) (v1.Deployment, bool) + GetGroup(ctx sdk.Context, id v1.GroupID) (types.Group, bool) + GetGroups(ctx sdk.Context, id v1.DeploymentID) []types.Group + Create(ctx sdk.Context, deployment v1.Deployment, groups []types.Group) error + UpdateDeployment(ctx sdk.Context, deployment v1.Deployment) error + CloseDeployment(ctx sdk.Context, deployment v1.Deployment) error + OnCloseGroup(ctx sdk.Context, group types.Group, state types.GroupState) error OnPauseGroup(ctx sdk.Context, group types.Group) error OnStartGroup(ctx sdk.Context, group types.Group) error - WithDeployments(ctx sdk.Context, fn func(types.Deployment) bool) - OnBidClosed(ctx sdk.Context, id types.GroupID) error - OnLeaseClosed(ctx sdk.Context, id types.GroupID) (types.Group, error) + WithDeployments(ctx sdk.Context, fn func(v1.Deployment) bool) + OnBidClosed(ctx sdk.Context, id v1.GroupID) error + OnLeaseClosed(ctx sdk.Context, id v1.GroupID) (types.Group, error) GetParams(ctx sdk.Context) (params types.Params) SetParams(ctx sdk.Context, params types.Params) - updateDeployment(ctx sdk.Context, obj types.Deployment) + updateDeployment(ctx sdk.Context, obj v1.Deployment) NewQuerier() Querier } // Keeper of the deployment store type Keeper struct { - skey sdk.StoreKey + skey storetypes.StoreKey cdc codec.BinaryCodec pspace paramtypes.Subspace ekeeper EscrowKeeper } // NewKeeper creates and returns an instance for deployment keeper -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, pspace paramtypes.Subspace, ekeeper EscrowKeeper) IKeeper { +func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey, pspace paramtypes.Subspace, ekeeper EscrowKeeper) IKeeper { if !pspace.HasKeyTable() { pspace = pspace.WithKeyTable(types.ParamKeyTable()) } @@ -63,23 +65,23 @@ func (k Keeper) Codec() codec.BinaryCodec { return k.cdc } -func (k Keeper) StoreKey() sdk.StoreKey { +func (k Keeper) StoreKey() storetypes.StoreKey { return k.skey } // GetDeployment returns deployment details with provided DeploymentID -func (k Keeper) GetDeployment(ctx sdk.Context, id types.DeploymentID) (types.Deployment, bool) { +func (k Keeper) GetDeployment(ctx sdk.Context, id v1.DeploymentID) (v1.Deployment, bool) { store := ctx.KVStore(k.skey) key := deploymentKey(id) if !store.Has(key) { - return types.Deployment{}, false + return v1.Deployment{}, false } buf := store.Get(key) - var val types.Deployment + var val v1.Deployment k.cdc.MustUnmarshal(buf, &val) @@ -87,7 +89,7 @@ func (k Keeper) GetDeployment(ctx sdk.Context, id types.DeploymentID) (types.Dep } // GetGroup returns group details with given GroupID from deployment store -func (k Keeper) GetGroup(ctx sdk.Context, id types.GroupID) (types.Group, bool) { +func (k Keeper) GetGroup(ctx sdk.Context, id v1.GroupID) (types.Group, bool) { store := ctx.KVStore(k.skey) key := groupKey(id) @@ -106,7 +108,7 @@ func (k Keeper) GetGroup(ctx sdk.Context, id types.GroupID) (types.Group, bool) } // GetGroups returns all groups of a deployment with given DeploymentID from deployment store -func (k Keeper) GetGroups(ctx sdk.Context, id types.DeploymentID) []types.Group { +func (k Keeper) GetGroups(ctx sdk.Context, id v1.DeploymentID) []types.Group { store := ctx.KVStore(k.skey) key := groupsKey(id) @@ -114,24 +116,27 @@ func (k Keeper) GetGroups(ctx sdk.Context, id types.DeploymentID) []types.Group iter := sdk.KVStorePrefixIterator(store, key) + defer func() { + _ = iter.Close() + }() + for ; iter.Valid(); iter.Next() { var val types.Group k.cdc.MustUnmarshal(iter.Value(), &val) vals = append(vals, val) } - iter.Close() return vals } // Create creates a new deployment with given deployment and group specifications -func (k Keeper) Create(ctx sdk.Context, deployment types.Deployment, groups []types.Group) error { +func (k Keeper) Create(ctx sdk.Context, deployment v1.Deployment, groups []types.Group) error { store := ctx.KVStore(k.skey) - key := deploymentKey(deployment.ID()) + key := deploymentKey(deployment.ID) if store.Has(key) { - return types.ErrDeploymentExists + return v1.ErrDeploymentExists } store.Set(key, k.cdc.MustMarshal(&deployment)) @@ -139,17 +144,22 @@ func (k Keeper) Create(ctx sdk.Context, deployment types.Deployment, groups []ty for idx := range groups { group := groups[idx] - if !group.ID().DeploymentID().Equals(deployment.ID()) { - return types.ErrInvalidGroupID + if !group.ID.DeploymentID().Equals(deployment.ID) { + return v1.ErrInvalidGroupID } - gkey := groupKey(group.ID()) + gkey := groupKey(group.ID) store.Set(gkey, k.cdc.MustMarshal(&group)) } - ctx.EventManager().EmitEvent( - types.NewEventDeploymentCreated(deployment.ID(), deployment.Version). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &v1.EventDeploymentCreated{ + ID: deployment.ID, + Hash: deployment.Hash, + }, ) + if err != nil { + return err + } telemetry.IncrCounter(1.0, "akash.deployment_created") @@ -157,59 +167,75 @@ func (k Keeper) Create(ctx sdk.Context, deployment types.Deployment, groups []ty } // UpdateDeployment updates deployment details -func (k Keeper) UpdateDeployment(ctx sdk.Context, deployment types.Deployment) error { +func (k Keeper) UpdateDeployment(ctx sdk.Context, deployment v1.Deployment) error { store := ctx.KVStore(k.skey) - key := deploymentKey(deployment.ID()) + key := deploymentKey(deployment.ID) if !store.Has(key) { - return types.ErrDeploymentNotFound + return v1.ErrDeploymentNotFound } - ctx.EventManager().EmitEvent( - types.NewEventDeploymentUpdated(deployment.ID(), deployment.Version). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &v1.EventDeploymentUpdated{ + ID: deployment.ID, + Hash: deployment.Hash, + }, ) + if err != nil { + return err + } store.Set(key, k.cdc.MustMarshal(&deployment)) return nil } -// UpdateDeployment updates deployment details -func (k Keeper) CloseDeployment(ctx sdk.Context, deployment types.Deployment) { - if deployment.State == types.DeploymentClosed { - return +// CloseDeployment close deployment +func (k Keeper) CloseDeployment(ctx sdk.Context, deployment v1.Deployment) error { + if deployment.State == v1.DeploymentClosed { + return v1.ErrDeploymentClosed } store := ctx.KVStore(k.skey) - key := deploymentKey(deployment.ID()) + key := deploymentKey(deployment.ID) if !store.Has(key) { - return + return v1.ErrDeploymentNotFound } - deployment.State = types.DeploymentClosed - ctx.EventManager().EmitEvent( - types.NewEventDeploymentClosed(deployment.ID()). - ToSDKEvent(), + deployment.State = v1.DeploymentClosed + + err := ctx.EventManager().EmitTypedEvent( + &v1.EventDeploymentClosed{ + ID: deployment.ID, + }, ) + if err != nil { + return err + } store.Set(key, k.cdc.MustMarshal(&deployment)) + + return nil } // OnCloseGroup provides shutdown API for a Group -func (k Keeper) OnCloseGroup(ctx sdk.Context, group types.Group, state types.Group_State) error { +func (k Keeper) OnCloseGroup(ctx sdk.Context, group types.Group, state types.GroupState) error { store := ctx.KVStore(k.skey) - key := groupKey(group.ID()) + key := groupKey(group.ID) if !store.Has(key) { - return types.ErrGroupNotFound + return v1.ErrGroupNotFound } group.State = state - ctx.EventManager().EmitEvent( - types.NewEventGroupClosed(group.ID()). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &v1.EventGroupClosed{ + ID: group.ID, + }, ) + if err != nil { + return err + } store.Set(key, k.cdc.MustMarshal(&group)) return nil @@ -218,17 +244,21 @@ func (k Keeper) OnCloseGroup(ctx sdk.Context, group types.Group, state types.Gro // OnPauseGroup provides shutdown API for a Group func (k Keeper) OnPauseGroup(ctx sdk.Context, group types.Group) error { store := ctx.KVStore(k.skey) - key := groupKey(group.ID()) + key := groupKey(group.ID) if !store.Has(key) { - return types.ErrGroupNotFound + return v1.ErrGroupNotFound } group.State = types.GroupPaused - ctx.EventManager().EmitEvent( - types.NewEventGroupPaused(group.ID()). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &v1.EventGroupPaused{ + ID: group.ID, + }, ) + if err != nil { + return err + } store.Set(key, k.cdc.MustMarshal(&group)) return nil @@ -237,29 +267,37 @@ func (k Keeper) OnPauseGroup(ctx sdk.Context, group types.Group) error { // OnStartGroup provides shutdown API for a Group func (k Keeper) OnStartGroup(ctx sdk.Context, group types.Group) error { store := ctx.KVStore(k.skey) - key := groupKey(group.ID()) + key := groupKey(group.ID) if !store.Has(key) { - return types.ErrGroupNotFound + return v1.ErrGroupNotFound } group.State = types.GroupOpen - ctx.EventManager().EmitEvent( - types.NewEventGroupStarted(group.ID()). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &v1.EventGroupStarted{ + ID: group.ID, + }, ) + if err != nil { + return err + } store.Set(key, k.cdc.MustMarshal(&group)) return nil } // WithDeployments iterates all deployments in deployment store -func (k Keeper) WithDeployments(ctx sdk.Context, fn func(types.Deployment) bool) { +func (k Keeper) WithDeployments(ctx sdk.Context, fn func(v1.Deployment) bool) { store := ctx.KVStore(k.skey) - iter := sdk.KVStorePrefixIterator(store, types.DeploymentPrefix()) - defer iter.Close() + iter := sdk.KVStorePrefixIterator(store, v1.DeploymentPrefix()) + + defer func() { + _ = iter.Close() + }() + for ; iter.Valid(); iter.Next() { - var val types.Deployment + var val v1.Deployment k.cdc.MustUnmarshal(iter.Value(), &val) if stop := fn(val); stop { break @@ -268,19 +306,19 @@ func (k Keeper) WithDeployments(ctx sdk.Context, fn func(types.Deployment) bool) } // OnBidClosed sets the group to state paused. -func (k Keeper) OnBidClosed(ctx sdk.Context, id types.GroupID) error { +func (k Keeper) OnBidClosed(ctx sdk.Context, id v1.GroupID) error { group, ok := k.GetGroup(ctx, id) if !ok { - return types.ErrGroupNotFound + return v1.ErrGroupNotFound } return k.OnPauseGroup(ctx, group) } // OnLeaseClosed keeps the group at state open -func (k Keeper) OnLeaseClosed(ctx sdk.Context, id types.GroupID) (types.Group, error) { +func (k Keeper) OnLeaseClosed(ctx sdk.Context, id v1.GroupID) (types.Group, error) { group, ok := k.GetGroup(ctx, id) if !ok { - return types.Group{}, types.ErrGroupNotFound + return types.Group{}, v1.ErrGroupNotFound } return group, nil } @@ -296,16 +334,16 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.pspace.SetParamSet(ctx, ¶ms) } -func (k Keeper) updateDeployment(ctx sdk.Context, obj types.Deployment) { +func (k Keeper) updateDeployment(ctx sdk.Context, obj v1.Deployment) { store := ctx.KVStore(k.skey) - key := deploymentKey(obj.ID()) + key := deploymentKey(obj.ID) store.Set(key, k.cdc.MustMarshal(&obj)) } // nolint: unused func (k Keeper) updateGroup(ctx sdk.Context, group types.Group) { store := ctx.KVStore(k.skey) - key := groupKey(group.ID()) + key := groupKey(group.ID) store.Set(key, k.cdc.MustMarshal(&group)) } diff --git a/x/deployment/keeper/keeper_test.go b/x/deployment/keeper/keeper_test.go index 1ef1eefd14..d0882a46ec 100644 --- a/x/deployment/keeper/keeper_test.go +++ b/x/deployment/keeper/keeper_test.go @@ -6,18 +6,20 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "pkg.akt.dev/go/node/deployment/v1beta4" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/deployment/keeper" + types "pkg.akt.dev/go/node/deployment/v1" + + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/deployment/keeper" ) func Test_Create(t *testing.T) { ctx, keeper := setupKeeper(t) deployment := testutil.Deployment(t) - groups := testutil.DeploymentGroups(t, deployment.ID(), 0) + groups := testutil.DeploymentGroups(t, deployment.ID, 0) err := keeper.Create(ctx, deployment, groups) require.NoError(t, err) @@ -26,7 +28,7 @@ func Test_Create(t *testing.T) { assert.Len(t, ctx.EventManager().Events(), 1) t.Run("deployment written", func(t *testing.T) { - result, ok := keeper.GetDeployment(ctx, deployment.ID()) + result, ok := keeper.GetDeployment(ctx, deployment.ID) assert.True(t, ok) assert.Equal(t, deployment, result) }) @@ -34,7 +36,7 @@ func Test_Create(t *testing.T) { t.Run("one deployment exists", func(t *testing.T) { count := 0 keeper.WithDeployments(ctx, func(d types.Deployment) bool { - if assert.Equal(t, deployment.ID(), d.ID()) { + if assert.Equal(t, deployment.ID, d.ID) { count++ } return false @@ -45,18 +47,18 @@ func Test_Create(t *testing.T) { // write more data. { deployment := testutil.Deployment(t) - groups := testutil.DeploymentGroups(t, deployment.ID(), 0) + groups := testutil.DeploymentGroups(t, deployment.ID, 0) assert.NoError(t, keeper.Create(ctx, deployment, groups)) } t.Run("groups written - read all", func(t *testing.T) { - result := keeper.GetGroups(ctx, deployment.ID()) + result := keeper.GetGroups(ctx, deployment.ID) assert.Equal(t, groups, result) }) // assert groups written - read single for i := 0; i < len(groups); i++ { - result, ok := keeper.GetGroup(ctx, groups[i].ID()) + result, ok := keeper.GetGroup(ctx, groups[i].ID) assert.True(t, ok) assert.Equal(t, groups[i], result) } @@ -71,7 +73,7 @@ func Test_Create_dupe(t *testing.T) { ctx, keeper := setupKeeper(t) deployment := testutil.Deployment(t) - groups := testutil.DeploymentGroups(t, deployment.ID(), 0) + groups := testutil.DeploymentGroups(t, deployment.ID, 0) err := keeper.Create(ctx, deployment, groups) require.NoError(t, err) @@ -97,7 +99,7 @@ func Test_UpdateDeployment(t *testing.T) { ctx, keeper := setupKeeper(t) deployment := testutil.Deployment(t) - groups := testutil.DeploymentGroups(t, deployment.ID(), 0) + groups := testutil.DeploymentGroups(t, deployment.ID, 0) err := keeper.UpdateDeployment(ctx, deployment) require.Error(t, err) @@ -105,12 +107,12 @@ func Test_UpdateDeployment(t *testing.T) { err = keeper.Create(ctx, deployment, groups) require.NoError(t, err) - deployment.Version = []byte{5, 6, 7, 8} + deployment.Hash = []byte{5, 6, 7, 8} err = keeper.UpdateDeployment(ctx, deployment) require.NoError(t, err) - result, ok := keeper.GetDeployment(ctx, deployment.ID()) + result, ok := keeper.GetDeployment(ctx, deployment.ID) require.True(t, ok) require.Equal(t, deployment, result) } @@ -121,7 +123,7 @@ func Test_OnEscrowAccountClosed_overdrawn(t *testing.T) { _, groups := createActiveDeployment(t, ctx, keeper) - did := groups[0].ID().DeploymentID() + did := groups[0].ID.DeploymentID() // eid := types.EscrowAccountForDeployment(did) @@ -133,15 +135,15 @@ func Test_OnEscrowAccountClosed_overdrawn(t *testing.T) { // keeper.OnEscrowAccountClosed(ctx, eobj) { - group, ok := keeper.GetGroup(ctx, groups[0].ID()) + group, ok := keeper.GetGroup(ctx, groups[0].ID) assert.True(t, ok) - assert.Equal(t, types.GroupInsufficientFunds, group.State) + assert.Equal(t, v1beta4.GroupInsufficientFunds, group.State) } { - group, ok := keeper.GetGroup(ctx, groups[1].ID()) + group, ok := keeper.GetGroup(ctx, groups[1].ID) assert.True(t, ok) - assert.Equal(t, types.GroupInsufficientFunds, group.State) + assert.Equal(t, v1beta4.GroupInsufficientFunds, group.State) } { @@ -156,19 +158,19 @@ func Test_OnBidClosed(t *testing.T) { _, groups := createActiveDeployment(t, ctx, keeper) - err := keeper.OnBidClosed(ctx, groups[0].ID()) + err := keeper.OnBidClosed(ctx, groups[0].ID) require.NoError(t, err) t.Run("target group changed", func(t *testing.T) { - group, ok := keeper.GetGroup(ctx, groups[0].ID()) + group, ok := keeper.GetGroup(ctx, groups[0].ID) assert.True(t, ok) - assert.Equal(t, types.GroupPaused, group.State) + assert.Equal(t, v1beta4.GroupPaused, group.State) }) t.Run("non-target group state unchanged", func(t *testing.T) { - group, ok := keeper.GetGroup(ctx, groups[1].ID()) + group, ok := keeper.GetGroup(ctx, groups[1].ID) assert.True(t, ok) - assert.Equal(t, types.GroupOpen, group.State) + assert.Equal(t, v1beta4.GroupOpen, group.State) }) } @@ -177,47 +179,47 @@ func Test_CloseGroup(t *testing.T) { _, groups := createActiveDeployment(t, ctx, keeper) t.Run("assert group 0 state closed", func(t *testing.T) { - assert.NoError(t, keeper.OnCloseGroup(ctx, groups[0], types.GroupClosed)) - group, ok := keeper.GetGroup(ctx, groups[0].ID()) + assert.NoError(t, keeper.OnCloseGroup(ctx, groups[0], v1beta4.GroupClosed)) + group, ok := keeper.GetGroup(ctx, groups[0].ID) assert.True(t, ok) - assert.Equal(t, types.GroupClosed, group.State) + assert.Equal(t, v1beta4.GroupClosed, group.State) - assert.Equal(t, types.GroupClosed, group.State) + assert.Equal(t, v1beta4.GroupClosed, group.State) }) t.Run("group 1 matched-state orderable", func(t *testing.T) { group := groups[1] - assert.Equal(t, types.GroupOpen, group.State) + assert.Equal(t, v1beta4.GroupOpen, group.State) }) } func Test_Empty_CloseGroup(t *testing.T) { ctx, keeper := setupKeeper(t) - group := types.Group{ - GroupID: testutil.GroupID(t), + group := v1beta4.Group{ + ID: testutil.GroupID(t), } t.Run("assert non-existent group returns error", func(t *testing.T) { - err := keeper.OnCloseGroup(ctx, group, types.GroupClosed) + err := keeper.OnCloseGroup(ctx, group, v1beta4.GroupClosed) assert.Error(t, err, "'group not found' error should be returned") }) } -func createActiveDeployment(t testing.TB, ctx sdk.Context, keeper keeper.IKeeper) (types.DeploymentID, []types.Group) { +func createActiveDeployment(t testing.TB, ctx sdk.Context, keeper keeper.IKeeper) (types.DeploymentID, v1beta4.Groups) { t.Helper() deployment := testutil.Deployment(t) - groups := []types.Group{ - testutil.DeploymentGroup(t, deployment.ID(), 0), - testutil.DeploymentGroup(t, deployment.ID(), 1), + groups := v1beta4.Groups{ + testutil.DeploymentGroup(t, deployment.ID, 0), + testutil.DeploymentGroup(t, deployment.ID, 1), } for i := range groups { - groups[i].State = types.GroupOpen + groups[i].State = v1beta4.GroupOpen } err := keeper.Create(ctx, deployment, groups) require.NoError(t, err) - return deployment.DeploymentID, groups + return deployment.ID, groups } func setupKeeper(t testing.TB) (sdk.Context, keeper.IKeeper) { diff --git a/x/deployment/keeper/key.go b/x/deployment/keeper/key.go index 5cc6b1e33e..a68faf8b6c 100644 --- a/x/deployment/keeper/key.go +++ b/x/deployment/keeper/key.go @@ -6,12 +6,13 @@ import ( "github.com/cosmos/cosmos-sdk/types/address" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - "github.com/akash-network/akash-api/go/sdkutil" + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" + "pkg.akt.dev/go/sdkutil" ) -func deploymentKey(id types.DeploymentID) []byte { - buf := bytes.NewBuffer(types.DeploymentPrefix()) +func deploymentKey(id v1.DeploymentID) []byte { + buf := bytes.NewBuffer(v1.DeploymentPrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) @@ -20,8 +21,8 @@ func deploymentKey(id types.DeploymentID) []byte { } // groupKey provides prefixed key for a Group's marshalled data. -func groupKey(id types.GroupID) []byte { - buf := bytes.NewBuffer(types.GroupPrefix()) +func groupKey(id v1.GroupID) []byte { + buf := bytes.NewBuffer(v1.GroupPrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) @@ -33,8 +34,8 @@ func groupKey(id types.GroupID) []byte { } // groupsKey provides default store Key for Group data. -func groupsKey(id types.DeploymentID) []byte { - buf := bytes.NewBuffer(types.GroupPrefix()) +func groupsKey(id v1.DeploymentID) []byte { + buf := bytes.NewBuffer(v1.GroupPrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) @@ -72,6 +73,6 @@ func filterToPrefix(prefix []byte, owner string, dseq uint64, gseq uint32) ([]by return buf.Bytes(), nil } -func deploymentPrefixFromFilter(f types.DeploymentFilters) ([]byte, error) { - return filterToPrefix(types.DeploymentPrefix(), f.Owner, f.DSeq, 0) +func deploymentPrefixFromFilter(f v1beta4.DeploymentFilters) ([]byte, error) { + return filterToPrefix(v1.DeploymentPrefix(), f.Owner, f.DSeq, 0) } diff --git a/x/deployment/module.go b/x/deployment/module.go index 99572c39dd..42cc69bc36 100644 --- a/x/deployment/module.go +++ b/x/deployment/module.go @@ -4,40 +4,36 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - sim "github.com/cosmos/cosmos-sdk/types/simulation" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - v1beta1types "github.com/akash-network/akash-api/go/node/deployment/v1beta1" - v1beta2types "github.com/akash-network/akash-api/go/node/deployment/v1beta2" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + v1 "pkg.akt.dev/go/node/deployment/v1" + types "pkg.akt.dev/go/node/deployment/v1beta4" - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/deployment/client/cli" - "github.com/akash-network/node/x/deployment/client/rest" - "github.com/akash-network/node/x/deployment/handler" - "github.com/akash-network/node/x/deployment/keeper" - "github.com/akash-network/node/x/deployment/simulation" + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/x/deployment/client/cli" + "pkg.akt.dev/akashd/x/deployment/client/rest" + "pkg.akt.dev/akashd/x/deployment/handler" + "pkg.akt.dev/akashd/x/deployment/keeper" ) // type check to ensure the interface is properly implemented var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModuleSimulation{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + // _ module.AppModuleSimulation = AppModuleSimulation{} ) // AppModuleBasic defines the basic application module used by the deployment module. @@ -47,7 +43,7 @@ type AppModuleBasic struct { // Name returns deployment module's name func (AppModuleBasic) Name() string { - return types.ModuleName + return v1.ModuleName } // RegisterLegacyAminoCodec registers the deployment module's types for the given codec. @@ -58,8 +54,8 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { types.RegisterInterfaces(registry) - v1beta2types.RegisterInterfaces(registry) - v1beta1types.RegisterInterfaces(registry) + // v1beta2types.RegisterInterfaces(registry) + // v1beta1types.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the deployment @@ -68,12 +64,12 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(DefaultGenesisState()) } -// ValidateGenesis does validation check of the Genesis and returns error incase of failure +// ValidateGenesis does validation check of the Genesis and returns error in case of failure func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState err := cdc.UnmarshalJSON(bz, &data) if err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %v", types.ModuleName, err) + return fmt.Errorf("failed to unmarshal %s genesis state: %v", v1.ModuleName, err) } return ValidateGenesis(&data) } @@ -130,27 +126,17 @@ func NewAppModule(cdc codec.Codec, k keeper.IKeeper, mkeeper handler.MarketKeepe // Name returns the deployment module name func (AppModule) Name() string { - return types.ModuleName + return v1.ModuleName } // RegisterInvariants registers module invariants func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} -// Route returns the message routing key for the deployment module -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, handler.NewHandler(am.keeper, am.mkeeper, am.ekeeper, am.authzKeeper)) -} - // QuerierRoute returns the deployment module's querier route name. func (am AppModule) QuerierRoute() string { return "" } -// LegacyQuerierHandler returns the sdk.Querier for deployment module -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers the module's services func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), handler.NewServer(am.keeper, am.mkeeper, am.ekeeper, am.authzKeeper)) @@ -211,28 +197,28 @@ func NewAppModuleSimulation(k keeper.IKeeper, akeeper govtypes.AccountKeeper, ba // AppModuleSimulation functions -// GenerateGenesisState creates a randomized GenState of the staking module. -func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModuleSimulation) RandomizedParams(r *rand.Rand) []sim.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for staking module's types -func (AppModuleSimulation) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - // sdr[StoreKey] = simulation.DecodeStore -} - -// WeightedOperations returns the all the staking module operations with their respective weights. -func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation { - return simulation.WeightedOperations(simState.AppParams, simState.Cdc, - am.akeeper, am.bkeeper, am.keeper) -} +// // GenerateGenesisState creates a randomized GenState of the staking module. +// func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { +// simulation.RandomizedGenState(simState) +// } +// +// // ProposalContents doesn't return any content functions for governance proposals. +// func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { +// return nil +// } +// +// // RandomizedParams creates randomized staking param changes for the simulator. +// func (AppModuleSimulation) RandomizedParams(r *rand.Rand) []sim.ParamChange { +// return nil +// } +// +// // RegisterStoreDecoder registers a decoder for staking module's types +// func (AppModuleSimulation) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +// // sdr[StoreKey] = simulation.DecodeStore +// } +// +// // WeightedOperations returns the all the staking module operations with their respective weights. +// func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation { +// return simulation.WeightedOperations(simState.AppParams, simState.Cdc, +// am.akeeper, am.bkeeper, am.keeper) +// } diff --git a/x/deployment/query/client.go b/x/deployment/query/client.go index a1cf623da7..048d0813db 100644 --- a/x/deployment/query/client.go +++ b/x/deployment/query/client.go @@ -3,7 +3,7 @@ package query import ( sdkclient "github.com/cosmos/cosmos-sdk/client" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + types "pkg.akt.dev/go/node/deployment/v1" ) // Client interface diff --git a/x/deployment/query/path.go b/x/deployment/query/path.go index 342704b79b..3174ec1e4b 100644 --- a/x/deployment/query/path.go +++ b/x/deployment/query/path.go @@ -5,7 +5,7 @@ import ( "fmt" "strconv" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + types "pkg.akt.dev/go/node/deployment/v1" ) const ( diff --git a/x/deployment/query/rawclient.go b/x/deployment/query/rawclient.go index 1f7b88db97..4287d94fbe 100644 --- a/x/deployment/query/rawclient.go +++ b/x/deployment/query/rawclient.go @@ -5,7 +5,7 @@ import ( sdkclient "github.com/cosmos/cosmos-sdk/client" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + types "pkg.akt.dev/go/node/deployment/v1" ) // RawClient interface diff --git a/x/deployment/query/types.go b/x/deployment/query/types.go index fb54477c91..da16e6a3d3 100644 --- a/x/deployment/query/types.go +++ b/x/deployment/query/types.go @@ -6,7 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/deployment/v1beta4" ) // DeploymentFilters defines flags for deployment list filter @@ -15,15 +16,15 @@ type DeploymentFilters struct { // State flag value given StateFlagVal string // Actual state value decoded from DeploymentStateMap - State types.Deployment_State + State v1.DeploymentState } // Accept returns whether deployment filters valid or not -func (filters DeploymentFilters) Accept(obj types.Deployment, isValidState bool) bool { +func (filters DeploymentFilters) Accept(obj v1.Deployment, isValidState bool) bool { if (filters.Owner.Empty() && !isValidState) || (filters.Owner.Empty() && (obj.State == filters.State)) || - (!isValidState && (obj.DeploymentID.Owner == filters.Owner.String())) || - (obj.DeploymentID.Owner == filters.Owner.String() && obj.State == filters.State) { + (!isValidState && (obj.ID.Owner == filters.Owner.String())) || + (obj.ID.Owner == filters.Owner.String() && obj.State == filters.State) { return true } @@ -32,8 +33,8 @@ func (filters DeploymentFilters) Accept(obj types.Deployment, isValidState bool) // Deployment stores deployment and groups details type Deployment struct { - types.Deployment `json:"deployment"` - Groups []types.Group `json:"groups"` + v1.Deployment `json:"deployment"` + Groups v1beta4.Groups `json:"groups"` } func (d Deployment) String() string { @@ -43,8 +44,7 @@ func (d Deployment) String() string { State: %v Version: %s Num Groups: %d - `, d.Deployment.DeploymentID.Owner, d.Deployment.DeploymentID.DSeq, - d.Deployment.State, d.Deployment.Version, len(d.Groups)) + `, d.Deployment.ID.Owner, d.Deployment.ID.DSeq, d.Deployment.State, d.Deployment.Hash, len(d.Groups)) } // Deployments represents slice of deployment struct @@ -68,7 +68,7 @@ func (ds Deployments) String() string { } // Group stores group ID, state and other specifications -type Group types.Group +type Group v1beta4.Group // GroupFilters defines flags for group list filter type GroupFilters struct { @@ -76,5 +76,5 @@ type GroupFilters struct { // State flag value given StateFlagVal string // Actual state value decoded from GroupStateMap - State types.Group_State + State v1beta4.GroupState } diff --git a/x/deployment/simulation/genesis.go b/x/deployment/simulation/genesis.go index d603a1e534..3e42cdacca 100644 --- a/x/deployment/simulation/genesis.go +++ b/x/deployment/simulation/genesis.go @@ -4,7 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + "pkg.akt.dev/go/node/deployment/v1" + types "pkg.akt.dev/go/node/deployment/v1beta4" ) var ( @@ -21,5 +22,5 @@ func RandomizedGenState(simState *module.SimulationState) { }, } - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(deploymentGenesis) + simState.GenState[v1.ModuleName] = simState.Cdc.MustMarshalJSON(deploymentGenesis) } diff --git a/x/deployment/simulation/operations.go b/x/deployment/simulation/operations.go index a3b09853f0..ca9f2a91d1 100644 --- a/x/deployment/simulation/operations.go +++ b/x/deployment/simulation/operations.go @@ -1,394 +1,393 @@ package simulation -import ( - "bytes" - "fmt" - "math/rand" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/simapp/helpers" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/cosmos-sdk/x/simulation" - - types "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - - appparams "github.com/akash-network/node/app/params" - sdlv1 "github.com/akash-network/node/sdl" - testsim "github.com/akash-network/node/testutil/sim" - "github.com/akash-network/node/x/deployment/keeper" -) - -// Simulation operation weights constants -const ( - OpWeightMsgCreateDeployment = "op_weight_msg_create_deployment" // nolint gosec - OpWeightMsgUpdateDeployment = "op_weight_msg_update_deployment" // nolint gosec - OpWeightMsgCloseDeployment = "op_weight_msg_close_deployment" // nolint gosec - OpWeightMsgCloseGroup = "op_weight_msg_close_group" // nolint gosec -) - -// WeightedOperations returns all the operations from the module with their respective weights -func WeightedOperations( - appParams simtypes.AppParams, cdc codec.JSONCodec, ak govtypes.AccountKeeper, - bk bankkeeper.Keeper, k keeper.IKeeper) simulation.WeightedOperations { - var ( - weightMsgCreateDeployment int - weightMsgUpdateDeployment int - weightMsgCloseDeployment int - weightMsgCloseGroup int - ) - - appParams.GetOrGenerate( - cdc, OpWeightMsgCreateDeployment, &weightMsgCreateDeployment, nil, func(r *rand.Rand) { - weightMsgCreateDeployment = appparams.DefaultWeightMsgCreateDeployment - }, - ) - - appParams.GetOrGenerate( - cdc, OpWeightMsgUpdateDeployment, &weightMsgUpdateDeployment, nil, func(r *rand.Rand) { - weightMsgUpdateDeployment = appparams.DefaultWeightMsgUpdateDeployment - }, - ) - - appParams.GetOrGenerate( - cdc, OpWeightMsgCloseDeployment, &weightMsgCloseDeployment, nil, func(r *rand.Rand) { - weightMsgCloseDeployment = appparams.DefaultWeightMsgCloseDeployment - }, - ) - - appParams.GetOrGenerate( - cdc, OpWeightMsgCloseGroup, &weightMsgCloseGroup, nil, func(r *rand.Rand) { - weightMsgCloseGroup = appparams.DefaultWeightMsgCloseGroup - }, - ) - - return simulation.WeightedOperations{ - simulation.NewWeightedOperation( - weightMsgCreateDeployment, - SimulateMsgCreateDeployment(ak, bk, k), - ), - simulation.NewWeightedOperation( - weightMsgUpdateDeployment, - SimulateMsgUpdateDeployment(ak, bk, k), - ), - simulation.NewWeightedOperation( - weightMsgCloseDeployment, - SimulateMsgCloseDeployment(ak, bk, k), - ), - simulation.NewWeightedOperation( - weightMsgCloseGroup, - SimulateMsgCloseGroup(ak, bk, k), - ), - } -} - -// SimulateMsgCreateDeployment generates a MsgCreate with random values -func SimulateMsgCreateDeployment(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, - chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accounts) - - dID := types.DeploymentID{ - Owner: simAccount.Address.String(), - DSeq: uint64(ctx.BlockHeight()), - } - - _, found := k.GetDeployment(ctx, dID) - if found { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "no deployment found"), nil, nil - } - - sdl, readError := sdlv1.ReadFile("../x/deployment/testdata/deployment.yaml") - if readError != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "unable to read config file"), - nil, readError - } - - groupSpecs, groupErr := sdl.DeploymentGroups() - if groupErr != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "unable to read groups"), nil, groupErr - } - sdlSum, err := sdl.Version() - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "error parsing deployment version sum"), - nil, err - } - - depositAmount := minDeposit - account := ak.GetAccount(ctx, simAccount.Address) - spendable := bk.SpendableCoins(ctx, account.GetAddress()) - - if spendable.AmountOf(depositAmount.Denom).LT(depositAmount.Amount.MulRaw(2)) { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "out of money"), nil, nil - } - spendable = spendable.Sub(sdk.NewCoins(depositAmount)) - - fees, err := simtypes.RandomFees(r, ctx, spendable) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "unable to generate fees"), nil, err - } - - msg := types.NewMsgCreateDeployment(dID, make([]types.GroupSpec, 0, len(groupSpecs)), sdlSum, depositAmount, simAccount.Address) - - for _, spec := range groupSpecs { - msg.Groups = append(msg.Groups, *spec) - } - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( - txGen, - []sdk.Msg{msg}, - fees, - helpers.DefaultGenTxGas, - chainID, - []uint64{account.GetAccountNumber()}, - []uint64{account.GetSequence()}, - simAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err - } - - _, _, err = app.Deliver(txGen.TxEncoder(), tx) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "create deployment - unable to deliver mock tx"), nil, err - } - - return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil - } -} - -// SimulateMsgUpdateDeployment generates a MsgUpdate with random values -func SimulateMsgUpdateDeployment(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, - chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - var deployments []types.Deployment - - sdl, readError := sdlv1.ReadFile("../x/deployment/testdata/deployment-v2.yaml") - if readError != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "unable to read config file"), nil, readError - } - - sdlSum, err := sdl.Version() - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "error parsing deployment version sum"), - nil, err - } - - k.WithDeployments(ctx, func(deployment types.Deployment) bool { - // skip deployments that already have been updated - if !bytes.Equal(deployment.Version, sdlSum) { - deployments = append(deployments, deployment) - } - - return false - }) - - if len(deployments) == 0 { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "no deployments found"), nil, nil - } - - // Get random deployment - deployment := deployments[testsim.RandIdx(r, len(deployments)-1)] - - if deployment.State != types.DeploymentActive { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "deployment closed"), nil, nil - } - - owner, convertErr := sdk.AccAddressFromBech32(deployment.ID().Owner) - if convertErr != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "error while converting address"), nil, convertErr - } - - simAccount, found := simtypes.FindAccount(accounts, owner) - if !found { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "unable to find deployment with given id"), - nil, fmt.Errorf("deployment with %s not found", deployment.ID().Owner) - } - - account := ak.GetAccount(ctx, simAccount.Address) - spendable := bk.SpendableCoins(ctx, account.GetAddress()) - - fees, err := simtypes.RandomFees(r, ctx, spendable) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "unable to generate fees"), nil, err - } - - msg := types.NewMsgUpdateDeployment(deployment.ID(), sdlSum) - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( - txGen, - []sdk.Msg{msg}, - fees, - helpers.DefaultGenTxGas, - chainID, - []uint64{account.GetAccountNumber()}, - []uint64{account.GetSequence()}, - simAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err - } - - _, _, err = app.Deliver(txGen.TxEncoder(), tx) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "update deployment - unable to deliver mock tx"), nil, err - } - - return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil - } -} - -// SimulateMsgCloseDeployment generates a MsgClose with random values -func SimulateMsgCloseDeployment(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, - chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - var deployments []types.Deployment - - k.WithDeployments(ctx, func(deployment types.Deployment) bool { - if deployment.State == types.DeploymentActive { - deployments = append(deployments, deployment) - } - - return false - }) - - if len(deployments) == 0 { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "no deployments found"), nil, nil - } - - // Get random deployment - deployment := deployments[testsim.RandIdx(r, len(deployments)-1)] - - owner, convertErr := sdk.AccAddressFromBech32(deployment.ID().Owner) - if convertErr != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "error while converting address"), nil, convertErr - } - - simAccount, found := simtypes.FindAccount(accounts, owner) - if !found { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "unable to find deployment"), nil, - fmt.Errorf("deployment with %s not found", deployment.ID().Owner) - } - - account := ak.GetAccount(ctx, simAccount.Address) - spendable := bk.SpendableCoins(ctx, account.GetAddress()) - - fees, err := simtypes.RandomFees(r, ctx, spendable) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "unable to generate fees"), nil, err - } - - msg := types.NewMsgCloseDeployment(deployment.ID()) - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( - txGen, - []sdk.Msg{msg}, - fees, - helpers.DefaultGenTxGas, - chainID, - []uint64{account.GetAccountNumber()}, - []uint64{account.GetSequence()}, - simAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err - } - - _, _, err = app.Deliver(txGen.TxEncoder(), tx) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "close deployment - unable to deliver mock tx"), nil, err - } - - return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil - } -} - -// SimulateMsgCloseGroup generates a MsgCloseGroup for a random deployment -func SimulateMsgCloseGroup(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, - chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - var deployments []types.Deployment - - k.WithDeployments(ctx, func(deployment types.Deployment) bool { - if deployment.State == types.DeploymentActive { - deployments = append(deployments, deployment) - } - - return false - }) - - if len(deployments) == 0 { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "no deployments found"), nil, nil - } - - // Get random deployment - deployment := deployments[testsim.RandIdx(r, len(deployments)-1)] - - owner, convertErr := sdk.AccAddressFromBech32(deployment.ID().Owner) - if convertErr != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "error while converting address"), nil, convertErr - } - - simAccount, found := simtypes.FindAccount(accounts, owner) - if !found { - err := fmt.Errorf("deployment with %s not found", deployment.ID().Owner) - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, err.Error()), nil, err - } - - account := ak.GetAccount(ctx, simAccount.Address) - spendable := bk.SpendableCoins(ctx, account.GetAddress()) - - fees, err := simtypes.RandomFees(r, ctx, spendable) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "unable to generate fees"), nil, err - } - - // Select Group to close - groups := k.GetGroups(ctx, deployment.ID()) - if len(groups) < 1 { - // No groups to close - err := fmt.Errorf("no groups for deployment ID: %v", deployment.ID()) - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, err.Error()), nil, err - } - group := groups[testsim.RandIdx(r, len(groups)-1)] - if group.State == types.GroupClosed { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "group already closed"), nil, nil - } - - msg := types.NewMsgCloseGroup(group.ID()) - - err = msg.ValidateBasic() - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "msg validation failure"), nil, err - } - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( - txGen, - []sdk.Msg{msg}, - fees, - helpers.DefaultGenTxGas, - chainID, - []uint64{account.GetAccountNumber()}, - []uint64{account.GetSequence()}, - simAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "close group - unable to generate mock tx"), nil, err - } - - _, _, err = app.Deliver(txGen.TxEncoder(), tx) - if err != nil { - err = fmt.Errorf("%w: %s: msg delivery error closing group: %v", err, types.ModuleName, group.ID()) - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), err.Error()), nil, err - } - return simtypes.NewOperationMsg(msg, true, "submitting MsgCloseGroup", nil), nil, nil - } -} +// import ( +// "bytes" +// "fmt" +// "math/rand" +// +// "github.com/cosmos/cosmos-sdk/baseapp" +// "github.com/cosmos/cosmos-sdk/codec" +// sdk "github.com/cosmos/cosmos-sdk/types" +// simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" +// govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +// "github.com/cosmos/cosmos-sdk/x/simulation" +// +// types "pkg.akt.dev/go/node/deployment/v1beta4" +// +// sdlv1 "pkg.akt.dev/go/sdl" +// +// appparams "pkg.akt.dev/akashd/app/params" +// testsim "pkg.akt.dev/akashd/testutil/sim" +// "pkg.akt.dev/akashd/x/deployment/keeper" +// ) +// +// // Simulation operation weights constants +// const ( +// OpWeightMsgCreateDeployment = "op_weight_msg_create_deployment" // nolint gosec +// OpWeightMsgUpdateDeployment = "op_weight_msg_update_deployment" // nolint gosec +// OpWeightMsgCloseDeployment = "op_weight_msg_close_deployment" // nolint gosec +// OpWeightMsgCloseGroup = "op_weight_msg_close_group" // nolint gosec +// ) +// +// // WeightedOperations returns all the operations from the module with their respective weights +// func WeightedOperations( +// appParams simtypes.AppParams, cdc codec.JSONCodec, ak govtypes.AccountKeeper, +// bk bankkeeper.Keeper, k keeper.IKeeper) simulation.WeightedOperations { +// var ( +// weightMsgCreateDeployment int +// weightMsgUpdateDeployment int +// weightMsgCloseDeployment int +// weightMsgCloseGroup int +// ) +// +// appParams.GetOrGenerate( +// cdc, OpWeightMsgCreateDeployment, &weightMsgCreateDeployment, nil, func(r *rand.Rand) { +// weightMsgCreateDeployment = appparams.DefaultWeightMsgCreateDeployment +// }, +// ) +// +// appParams.GetOrGenerate( +// cdc, OpWeightMsgUpdateDeployment, &weightMsgUpdateDeployment, nil, func(r *rand.Rand) { +// weightMsgUpdateDeployment = appparams.DefaultWeightMsgUpdateDeployment +// }, +// ) +// +// appParams.GetOrGenerate( +// cdc, OpWeightMsgCloseDeployment, &weightMsgCloseDeployment, nil, func(r *rand.Rand) { +// weightMsgCloseDeployment = appparams.DefaultWeightMsgCloseDeployment +// }, +// ) +// +// appParams.GetOrGenerate( +// cdc, OpWeightMsgCloseGroup, &weightMsgCloseGroup, nil, func(r *rand.Rand) { +// weightMsgCloseGroup = appparams.DefaultWeightMsgCloseGroup +// }, +// ) +// +// return simulation.WeightedOperations{ +// simulation.NewWeightedOperation( +// weightMsgCreateDeployment, +// SimulateMsgCreateDeployment(ak, bk, k), +// ), +// simulation.NewWeightedOperation( +// weightMsgUpdateDeployment, +// SimulateMsgUpdateDeployment(ak, bk, k), +// ), +// simulation.NewWeightedOperation( +// weightMsgCloseDeployment, +// SimulateMsgCloseDeployment(ak, bk, k), +// ), +// simulation.NewWeightedOperation( +// weightMsgCloseGroup, +// SimulateMsgCloseGroup(ak, bk, k), +// ), +// } +// } +// +// // SimulateMsgCreateDeployment generates a MsgCreate with random values +// func SimulateMsgCreateDeployment(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { +// return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, +// chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { +// simAccount, _ := simtypes.RandomAcc(r, accounts) +// +// dID := types.DeploymentID{ +// Owner: simAccount.Address.String(), +// DSeq: uint64(ctx.BlockHeight()), +// } +// +// _, found := k.GetDeployment(ctx, dID) +// if found { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "no deployment found"), nil, nil +// } +// +// sdl, readError := sdlv1.ReadFile("../x/deployment/testdata/deployment.yaml") +// if readError != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "unable to read config file"), +// nil, readError +// } +// +// groupSpecs, groupErr := sdl.DeploymentGroups() +// if groupErr != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "unable to read groups"), nil, groupErr +// } +// sdlSum, err := sdl.Version() +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "error parsing deployment version sum"), +// nil, err +// } +// +// depositAmount := minDeposit +// account := ak.GetAccount(ctx, simAccount.Address) +// spendable := bk.SpendableCoins(ctx, account.GetAddress()) +// +// if spendable.AmountOf(depositAmount.Denom).LT(depositAmount.Amount.MulRaw(2)) { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "out of money"), nil, nil +// } +// spendable = spendable.Sub(sdk.NewCoins(depositAmount)) +// +// fees, err := simtypes.RandomFees(r, ctx, spendable) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCreateDeployment, "unable to generate fees"), nil, err +// } +// +// msg := types.NewMsgCreateDeployment(dID, make([]types.GroupSpec, 0, len(groupSpecs)), sdlSum, depositAmount, simAccount.Address) +// +// for _, spec := range groupSpecs { +// msg.Groups = append(msg.Groups, *spec) +// } +// +// txGen := simappparams.MakeTestEncodingConfig().TxConfig +// tx, err := helpers.GenTx( +// txGen, +// []sdk.Msg{msg}, +// fees, +// helpers.DefaultGenTxGas, +// chainID, +// []uint64{account.GetAccountNumber()}, +// []uint64{account.GetSequence()}, +// simAccount.PrivKey, +// ) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err +// } +// +// _, _, err = app.Deliver(txGen.TxEncoder(), tx) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "create deployment - unable to deliver mock tx"), nil, err +// } +// +// return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil +// } +// } +// +// // SimulateMsgUpdateDeployment generates a MsgUpdate with random values +// func SimulateMsgUpdateDeployment(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { +// return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, +// chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { +// var deployments []types.Deployment +// +// sdl, readError := sdlv1.ReadFile("../x/deployment/testdata/deployment-v2.yaml") +// if readError != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "unable to read config file"), nil, readError +// } +// +// sdlSum, err := sdl.Version() +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "error parsing deployment version sum"), +// nil, err +// } +// +// k.WithDeployments(ctx, func(deployment types.Deployment) bool { +// // skip deployments that already have been updated +// if !bytes.Equal(deployment.Version, sdlSum) { +// deployments = append(deployments, deployment) +// } +// +// return false +// }) +// +// if len(deployments) == 0 { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "no deployments found"), nil, nil +// } +// +// // Get random deployment +// deployment := deployments[testsim.RandIdx(r, len(deployments)-1)] +// +// if deployment.State != types.DeploymentActive { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "deployment closed"), nil, nil +// } +// +// owner, convertErr := sdk.AccAddressFromBech32(deployment.ID().Owner) +// if convertErr != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "error while converting address"), nil, convertErr +// } +// +// simAccount, found := simtypes.FindAccount(accounts, owner) +// if !found { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "unable to find deployment with given id"), +// nil, fmt.Errorf("deployment with %s not found", deployment.ID().Owner) +// } +// +// account := ak.GetAccount(ctx, simAccount.Address) +// spendable := bk.SpendableCoins(ctx, account.GetAddress()) +// +// fees, err := simtypes.RandomFees(r, ctx, spendable) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeUpdateDeployment, "unable to generate fees"), nil, err +// } +// +// msg := types.NewMsgUpdateDeployment(deployment.ID(), sdlSum) +// +// txGen := simappparams.MakeTestEncodingConfig().TxConfig +// tx, err := helpers.GenTx( +// txGen, +// []sdk.Msg{msg}, +// fees, +// helpers.DefaultGenTxGas, +// chainID, +// []uint64{account.GetAccountNumber()}, +// []uint64{account.GetSequence()}, +// simAccount.PrivKey, +// ) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err +// } +// +// _, _, err = app.Deliver(txGen.TxEncoder(), tx) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "update deployment - unable to deliver mock tx"), nil, err +// } +// +// return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil +// } +// } +// +// // SimulateMsgCloseDeployment generates a MsgClose with random values +// func SimulateMsgCloseDeployment(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { +// return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, +// chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { +// var deployments []types.Deployment +// +// k.WithDeployments(ctx, func(deployment types.Deployment) bool { +// if deployment.State == types.DeploymentActive { +// deployments = append(deployments, deployment) +// } +// +// return false +// }) +// +// if len(deployments) == 0 { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "no deployments found"), nil, nil +// } +// +// // Get random deployment +// deployment := deployments[testsim.RandIdx(r, len(deployments)-1)] +// +// owner, convertErr := sdk.AccAddressFromBech32(deployment.ID().Owner) +// if convertErr != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "error while converting address"), nil, convertErr +// } +// +// simAccount, found := simtypes.FindAccount(accounts, owner) +// if !found { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "unable to find deployment"), nil, +// fmt.Errorf("deployment with %s not found", deployment.ID().Owner) +// } +// +// account := ak.GetAccount(ctx, simAccount.Address) +// spendable := bk.SpendableCoins(ctx, account.GetAddress()) +// +// fees, err := simtypes.RandomFees(r, ctx, spendable) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseDeployment, "unable to generate fees"), nil, err +// } +// +// msg := types.NewMsgCloseDeployment(deployment.ID()) +// +// txGen := simappparams.MakeTestEncodingConfig().TxConfig +// tx, err := helpers.GenTx( +// txGen, +// []sdk.Msg{msg}, +// fees, +// helpers.DefaultGenTxGas, +// chainID, +// []uint64{account.GetAccountNumber()}, +// []uint64{account.GetSequence()}, +// simAccount.PrivKey, +// ) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err +// } +// +// _, _, err = app.Deliver(txGen.TxEncoder(), tx) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "close deployment - unable to deliver mock tx"), nil, err +// } +// +// return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil +// } +// } +// +// // SimulateMsgCloseGroup generates a MsgCloseGroup for a random deployment +// func SimulateMsgCloseGroup(ak govtypes.AccountKeeper, bk bankkeeper.Keeper, k keeper.IKeeper) simtypes.Operation { +// return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accounts []simtypes.Account, +// chainID string) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { +// var deployments []types.Deployment +// +// k.WithDeployments(ctx, func(deployment types.Deployment) bool { +// if deployment.State == types.DeploymentActive { +// deployments = append(deployments, deployment) +// } +// +// return false +// }) +// +// if len(deployments) == 0 { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "no deployments found"), nil, nil +// } +// +// // Get random deployment +// deployment := deployments[testsim.RandIdx(r, len(deployments)-1)] +// +// owner, convertErr := sdk.AccAddressFromBech32(deployment.ID().Owner) +// if convertErr != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "error while converting address"), nil, convertErr +// } +// +// simAccount, found := simtypes.FindAccount(accounts, owner) +// if !found { +// err := fmt.Errorf("deployment with %s not found", deployment.ID().Owner) +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, err.Error()), nil, err +// } +// +// account := ak.GetAccount(ctx, simAccount.Address) +// spendable := bk.SpendableCoins(ctx, account.GetAddress()) +// +// fees, err := simtypes.RandomFees(r, ctx, spendable) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "unable to generate fees"), nil, err +// } +// +// // Select Group to close +// groups := k.GetGroups(ctx, deployment.ID()) +// if len(groups) < 1 { +// // No groups to close +// err := fmt.Errorf("no groups for deployment ID: %v", deployment.ID()) +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, err.Error()), nil, err +// } +// group := groups[testsim.RandIdx(r, len(groups)-1)] +// if group.State == types.GroupClosed { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "group already closed"), nil, nil +// } +// +// msg := types.NewMsgCloseGroup(group.ID()) +// +// err = msg.ValidateBasic() +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, types.MsgTypeCloseGroup, "msg validation failure"), nil, err +// } +// +// txGen := simappparams.MakeTestEncodingConfig().TxConfig +// tx, err := helpers.GenTx( +// txGen, +// []sdk.Msg{msg}, +// fees, +// helpers.DefaultGenTxGas, +// chainID, +// []uint64{account.GetAccountNumber()}, +// []uint64{account.GetSequence()}, +// simAccount.PrivKey, +// ) +// if err != nil { +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "close group - unable to generate mock tx"), nil, err +// } +// +// _, _, err = app.Deliver(txGen.TxEncoder(), tx) +// if err != nil { +// err = fmt.Errorf("%w: %s: msg delivery error closing group: %v", err, types.ModuleName, group.ID()) +// return simtypes.NoOpMsg(types.ModuleName, msg.Type(), err.Error()), nil, err +// } +// return simtypes.NewOperationMsg(msg, true, "submitting MsgCloseGroup", nil), nil, nil +// } +// } diff --git a/x/escrow/alias.go b/x/escrow/alias.go index 0191c57dcf..a8463d2554 100644 --- a/x/escrow/alias.go +++ b/x/escrow/alias.go @@ -1,7 +1,7 @@ package escrow import ( - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + types "pkg.akt.dev/go/node/escrow/v1beta3" ) const ( diff --git a/x/escrow/client/cli/query.go b/x/escrow/client/cli/query.go index 915afc1c7f..9ab74db533 100644 --- a/x/escrow/client/cli/query.go +++ b/x/escrow/client/cli/query.go @@ -5,25 +5,28 @@ import ( "errors" "time" - sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" + "pkg.akt.dev/go/cli" + "gopkg.in/yaml.v3" - deploymentTypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + sdkclient "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" - marketTypes "github.com/akash-network/akash-api/go/node/market/v1beta4" + dv1 "pkg.akt.dev/go/node/deployment/v1" + dv1beta4 "pkg.akt.dev/go/node/deployment/v1beta4" + etypes "pkg.akt.dev/go/node/escrow/v1" + mv1 "pkg.akt.dev/go/node/market/v1" + mv1beta5 "pkg.akt.dev/go/node/market/v1beta5" - aclient "github.com/akash-network/node/client" - netutil "github.com/akash-network/node/util/network" - "github.com/akash-network/node/x/deployment/client/cli" - "github.com/akash-network/node/x/escrow/client/util" + netutil "pkg.akt.dev/akashd/util/network" + // "pkg.akt.dev/akashd/x/deployment/client/cli" + "pkg.akt.dev/akashd/x/escrow/client/util" ) func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ - Use: types.ModuleName, + Use: etypes.ModuleName, Short: "Escrow query commands", SuggestionsMinimumDistance: 2, RunE: sdkclient.ValidateCmd, @@ -51,7 +54,7 @@ func cmdBlocksRemaining() *cobra.Command { return err } - qq, err := aclient.DiscoverQueryClient(ctx, cctx) + qq, err := cli.DiscoverQueryClient(ctx, cctx) if err != nil { return err } @@ -62,19 +65,19 @@ func cmdBlocksRemaining() *cobra.Command { } // Fetch leases matching owner & dseq - leaseRequest := marketTypes.QueryLeasesRequest{ - Filters: marketTypes.LeaseFilters{ + leaseRequest := mv1beta5.QueryLeasesRequest{ + Filters: mv1.LeaseFilters{ Owner: id.Owner, DSeq: id.DSeq, GSeq: 0, OSeq: 0, Provider: "", - State: "active", + State: mv1.LeaseActive.String(), }, Pagination: nil, } - leasesResponse, err := qq.Leases(cmd.Context(), &leaseRequest) + leasesResponse, err := qq.Query().Leases(ctx, &leaseRequest) if err != nil { return err } @@ -85,13 +88,13 @@ func cmdBlocksRemaining() *cobra.Command { // Fetch the balance of the escrow account totalLeaseAmount := leasesResponse.TotalPriceAmount() - blockchainHeight, err := cli.CurrentBlockHeight(qq.ClientContext()) + blockchainHeight, err := qq.Node().CurrentBlockHeight(ctx) if err != nil { return err } - res, err := qq.Deployment(cmd.Context(), &deploymentTypes.QueryDeploymentRequest{ - ID: deploymentTypes.DeploymentID{Owner: id.Owner, DSeq: id.DSeq}, + res, err := qq.Query().Deployment(cmd.Context(), &dv1beta4.QueryDeploymentRequest{ + ID: dv1.DeploymentID{Owner: id.Owner, DSeq: id.DSeq}, }) if err != nil { return err diff --git a/x/escrow/client/rest/rest.go b/x/escrow/client/rest/rest.go index 0fe9350432..79c2b1605a 100644 --- a/x/escrow/client/rest/rest.go +++ b/x/escrow/client/rest/rest.go @@ -5,5 +5,5 @@ import ( "github.com/gorilla/mux" ) -func RegisterRoutes(ctx client.Context, r *mux.Router, ns string) { +func RegisterRoutes(_ client.Context, _ *mux.Router, _ string) { } diff --git a/x/escrow/genesis.go b/x/escrow/genesis.go index ddc07ce9d9..1064ccca1e 100644 --- a/x/escrow/genesis.go +++ b/x/escrow/genesis.go @@ -4,13 +4,13 @@ import ( "encoding/json" "fmt" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/akash-network/node/x/escrow/keeper" + "pkg.akt.dev/akashd/x/escrow/keeper" - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + types "pkg.akt.dev/go/node/escrow/v1" ) // ValidateGenesis does validation check of the Genesis and returns error in case of failure diff --git a/x/escrow/keeper/external.go b/x/escrow/keeper/external.go index d4fef815b1..a7bba8aa5c 100644 --- a/x/escrow/keeper/external.go +++ b/x/escrow/keeper/external.go @@ -25,6 +25,6 @@ type DistrKeeper interface { type AuthzKeeper interface { DeleteGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) error - GetCleanAuthorization(ctx sdk.Context, grantee, granter sdk.AccAddress, msgType string) (cap authz.Authorization, expiration time.Time) - SaveGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration time.Time) error + GetAuthorization(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) (authz.Authorization, *time.Time) + SaveGrant(ctx sdk.Context, grantee, granter sdk.AccAddress, authorization authz.Authorization, expiration *time.Time) error } diff --git a/x/escrow/keeper/keeper.go b/x/escrow/keeper/keeper.go index a521c11af8..87666c2812 100644 --- a/x/escrow/keeper/keeper.go +++ b/x/escrow/keeper/keeper.go @@ -3,37 +3,47 @@ package keeper import ( "fmt" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + + dv1 "pkg.akt.dev/go/node/deployment/v1" + "pkg.akt.dev/go/node/escrow/v1" ) -type AccountHook func(sdk.Context, types.Account) -type PaymentHook func(sdk.Context, types.FractionalPayment) +type AccountHook func(sdk.Context, v1.Account) +type PaymentHook func(sdk.Context, v1.FractionalPayment) type Keeper interface { Codec() codec.BinaryCodec - StoreKey() sdk.StoreKey - AccountCreate(ctx sdk.Context, id types.AccountID, owner, depositor sdk.AccAddress, deposit sdk.Coin) error - AccountDeposit(ctx sdk.Context, id types.AccountID, depositor sdk.AccAddress, amount sdk.Coin) error - AccountSettle(ctx sdk.Context, id types.AccountID) (bool, error) - AccountClose(ctx sdk.Context, id types.AccountID) error - PaymentCreate(ctx sdk.Context, id types.AccountID, pid string, owner sdk.AccAddress, rate sdk.DecCoin) error - PaymentWithdraw(ctx sdk.Context, id types.AccountID, pid string) error - PaymentClose(ctx sdk.Context, id types.AccountID, pid string) error - GetAccount(ctx sdk.Context, id types.AccountID) (types.Account, error) - GetPayment(ctx sdk.Context, id types.AccountID, pid string) (types.FractionalPayment, error) + StoreKey() storetypes.StoreKey + AccountCreate(ctx sdk.Context, id v1.AccountID, owner, depositor sdk.AccAddress, deposit sdk.Coin) error + AccountDeposit(ctx sdk.Context, id v1.AccountID, depositor sdk.AccAddress, amount sdk.Coin) error + AccountSettle(ctx sdk.Context, id v1.AccountID) (bool, error) + AccountClose(ctx sdk.Context, id v1.AccountID) error + PaymentCreate(ctx sdk.Context, id v1.AccountID, pid string, owner sdk.AccAddress, rate sdk.DecCoin) error + PaymentWithdraw(ctx sdk.Context, id v1.AccountID, pid string) error + PaymentClose(ctx sdk.Context, id v1.AccountID, pid string) error + GetAccount(ctx sdk.Context, id v1.AccountID) (v1.Account, error) + GetPayment(ctx sdk.Context, id v1.AccountID, pid string) (v1.FractionalPayment, error) AddOnAccountClosedHook(AccountHook) Keeper AddOnPaymentClosedHook(PaymentHook) Keeper - WithAccounts(sdk.Context, func(types.Account) bool) - WithPayments(sdk.Context, func(types.FractionalPayment) bool) - SaveAccount(sdk.Context, types.Account) - SavePayment(sdk.Context, types.FractionalPayment) -} - -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, bkeeper BankKeeper, tkeeper TakeKeeper, dkeeper DistrKeeper, akeeper AuthzKeeper) Keeper { + WithAccounts(sdk.Context, func(v1.Account) bool) + WithPayments(sdk.Context, func(v1.FractionalPayment) bool) + SaveAccount(sdk.Context, v1.Account) + SavePayment(sdk.Context, v1.FractionalPayment) +} + +func NewKeeper( + cdc codec.BinaryCodec, + skey storetypes.StoreKey, + bkeeper BankKeeper, + tkeeper TakeKeeper, + dkeeper DistrKeeper, + akeeper AuthzKeeper, +) Keeper { return &keeper{ cdc: cdc, skey: skey, @@ -46,7 +56,7 @@ func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, bkeeper BankKeeper, tke type keeper struct { cdc codec.BinaryCodec - skey sdk.StoreKey + skey storetypes.StoreKey bkeeper BankKeeper tkeeper TakeKeeper dkeeper DistrKeeper @@ -63,22 +73,22 @@ func (k *keeper) Codec() codec.BinaryCodec { } // StoreKey returns store key -func (k *keeper) StoreKey() sdk.StoreKey { +func (k *keeper) StoreKey() storetypes.StoreKey { return k.skey } -func (k *keeper) AccountCreate(ctx sdk.Context, id types.AccountID, owner, depositor sdk.AccAddress, deposit sdk.Coin) error { +func (k *keeper) AccountCreate(ctx sdk.Context, id v1.AccountID, owner, depositor sdk.AccAddress, deposit sdk.Coin) error { store := ctx.KVStore(k.skey) key := accountKey(id) if store.Has(key) { - return types.ErrAccountExists + return v1.ErrAccountExists } - obj := &types.Account{ + obj := &v1.Account{ ID: id, Owner: owner.String(), - State: types.AccountOpen, + State: v1.AccountOpen, Balance: sdk.NewDecCoin(deposit.Denom, sdk.ZeroInt()), Transferred: sdk.NewDecCoin(deposit.Denom, sdk.ZeroInt()), SettledAt: ctx.BlockHeight(), @@ -101,8 +111,14 @@ func (k *keeper) AccountCreate(ctx sdk.Context, id types.AccountID, owner, depos // fetchDepositToAccount fetches deposit amount from the depositor's account to the escrow // account and accordingly updates the balance or funds. -func (k *keeper) fetchDepositToAccount(ctx sdk.Context, acc *types.Account, owner, depositor sdk.AccAddress, deposit sdk.Coin) error { - if err := k.bkeeper.SendCoinsFromAccountToModule(ctx, depositor, types.ModuleName, sdk.NewCoins(deposit)); err != nil { +func (k *keeper) fetchDepositToAccount( + ctx sdk.Context, + acc *v1.Account, + owner sdk.AccAddress, + depositor sdk.AccAddress, + deposit sdk.Coin, +) error { + if err := k.bkeeper.SendCoinsFromAccountToModule(ctx, depositor, v1.ModuleName, sdk.NewCoins(deposit)); err != nil { return err } @@ -115,7 +131,7 @@ func (k *keeper) fetchDepositToAccount(ctx sdk.Context, acc *types.Account, owne return nil } -func (k *keeper) GetAccountDepositor(ctx sdk.Context, id types.AccountID) (sdk.AccAddress, error) { +func (k *keeper) GetAccountDepositor(ctx sdk.Context, id v1.AccountID) (sdk.AccAddress, error) { obj, err := k.GetAccount(ctx, id) if err != nil { return sdk.AccAddress{}, err @@ -129,7 +145,7 @@ func (k *keeper) GetAccountDepositor(ctx sdk.Context, id types.AccountID) (sdk.A return depositor, nil } -func (k *keeper) AccountDeposit(ctx sdk.Context, id types.AccountID, depositor sdk.AccAddress, amount sdk.Coin) error { +func (k *keeper) AccountDeposit(ctx sdk.Context, id v1.AccountID, depositor sdk.AccAddress, amount sdk.Coin) error { store := ctx.KVStore(k.skey) key := accountKey(id) @@ -138,8 +154,8 @@ func (k *keeper) AccountDeposit(ctx sdk.Context, id types.AccountID, depositor s return err } - if obj.State != types.AccountOpen { - return types.ErrAccountClosed + if obj.State != v1.AccountOpen { + return v1.ErrAccountClosed } owner, err := sdk.AccAddressFromBech32(obj.Owner) @@ -156,7 +172,7 @@ func (k *keeper) AccountDeposit(ctx sdk.Context, id types.AccountID, depositor s if currDepositor.Equals(owner) { obj.Depositor = depositor.String() } else if !currDepositor.Equals(depositor) { - return types.ErrInvalidAccountDepositor + return v1.ErrInvalidAccountDepositor } } @@ -169,13 +185,13 @@ func (k *keeper) AccountDeposit(ctx sdk.Context, id types.AccountID, depositor s return nil } -func (k *keeper) AccountSettle(ctx sdk.Context, id types.AccountID) (bool, error) { +func (k *keeper) AccountSettle(ctx sdk.Context, id v1.AccountID) (bool, error) { _, _, od, err := k.doAccountSettle(ctx, id) return od, err } -func (k *keeper) AccountClose(ctx sdk.Context, id types.AccountID) error { +func (k *keeper) AccountClose(ctx sdk.Context, id v1.AccountID) error { // doAccountSettle checks if account is open account, payments, od, err := k.doAccountSettle(ctx, id) if err != nil { @@ -186,13 +202,13 @@ func (k *keeper) AccountClose(ctx sdk.Context, id types.AccountID) error { return nil } - account.State = types.AccountClosed + account.State = v1.AccountClosed if err := k.accountWithdraw(ctx, &account); err != nil { return err } for idx := range payments { - payments[idx].State = types.PaymentClosed + payments[idx].State = v1.PaymentClosed if err := k.paymentWithdraw(ctx, &payments[idx]); err != nil { return err } @@ -211,36 +227,36 @@ func (k *keeper) AccountClose(ctx sdk.Context, id types.AccountID) error { return nil } -func (k *keeper) PaymentCreate(ctx sdk.Context, id types.AccountID, pid string, owner sdk.AccAddress, rate sdk.DecCoin) error { +func (k *keeper) PaymentCreate(ctx sdk.Context, id v1.AccountID, pid string, owner sdk.AccAddress, rate sdk.DecCoin) error { account, _, od, err := k.doAccountSettle(ctx, id) if err != nil { return err } if od { - return types.ErrAccountOverdrawn + return v1.ErrAccountOverdrawn } if rate.Denom != account.Balance.Denom { - return types.ErrInvalidDenomination + return v1.ErrInvalidDenomination } if rate.IsZero() { - return types.ErrPaymentRateZero + return v1.ErrPaymentRateZero } store := ctx.KVStore(k.skey) key := paymentKey(id, pid) if store.Has(key) { - return types.ErrPaymentExists + return v1.ErrPaymentExists } - obj := &types.FractionalPayment{ + obj := &v1.FractionalPayment{ AccountID: id, PaymentID: pid, Owner: owner.String(), - State: types.PaymentOpen, + State: v1.PaymentOpen, Rate: rate, Balance: sdk.NewDecCoin(rate.Denom, sdk.ZeroInt()), Withdrawn: sdk.NewCoin(rate.Denom, sdk.ZeroInt()), @@ -251,14 +267,14 @@ func (k *keeper) PaymentCreate(ctx sdk.Context, id types.AccountID, pid string, return nil } -func (k *keeper) PaymentWithdraw(ctx sdk.Context, id types.AccountID, pid string) error { +func (k *keeper) PaymentWithdraw(ctx sdk.Context, id v1.AccountID, pid string) error { payment, err := k.GetPayment(ctx, id, pid) if err != nil { return err } - if payment.State != types.PaymentOpen { - return types.ErrPaymentClosed + if payment.State != v1.PaymentOpen { + return v1.ErrPaymentClosed } od, err := k.AccountSettle(ctx, id) @@ -278,14 +294,14 @@ func (k *keeper) PaymentWithdraw(ctx sdk.Context, id types.AccountID, pid string return k.paymentWithdraw(ctx, &payment) } -func (k *keeper) PaymentClose(ctx sdk.Context, id types.AccountID, pid string) error { +func (k *keeper) PaymentClose(ctx sdk.Context, id v1.AccountID, pid string) error { payment, err := k.GetPayment(ctx, id, pid) if err != nil { return err } - if payment.State != types.PaymentOpen { - return types.ErrPaymentClosed + if payment.State != v1.PaymentOpen { + return v1.ErrPaymentClosed } od, err := k.AccountSettle(ctx, id) @@ -302,7 +318,7 @@ func (k *keeper) PaymentClose(ctx sdk.Context, id types.AccountID, pid string) e return err } - payment.State = types.PaymentClosed + payment.State = v1.PaymentClosed if err := k.paymentWithdraw(ctx, &payment); err != nil { return err @@ -325,58 +341,58 @@ func (k *keeper) AddOnPaymentClosedHook(hook PaymentHook) Keeper { return k } -func (k *keeper) GetAccount(ctx sdk.Context, id types.AccountID) (types.Account, error) { +func (k *keeper) GetAccount(ctx sdk.Context, id v1.AccountID) (v1.Account, error) { store := ctx.KVStore(k.skey) key := accountKey(id) if !store.Has(key) { - return types.Account{}, types.ErrAccountNotFound + return v1.Account{}, v1.ErrAccountNotFound } buf := store.Get(key) - var obj types.Account + var obj v1.Account k.cdc.MustUnmarshal(buf, &obj) return obj, nil } -func (k *keeper) GetPayment(ctx sdk.Context, id types.AccountID, pid string) (types.FractionalPayment, error) { +func (k *keeper) GetPayment(ctx sdk.Context, id v1.AccountID, pid string) (v1.FractionalPayment, error) { store := ctx.KVStore(k.skey) key := paymentKey(id, pid) if !store.Has(key) { - return types.FractionalPayment{}, types.ErrPaymentNotFound + return v1.FractionalPayment{}, v1.ErrPaymentNotFound } buf := store.Get(key) - var obj types.FractionalPayment + var obj v1.FractionalPayment k.cdc.MustUnmarshal(buf, &obj) return obj, nil } -func (k *keeper) SaveAccount(ctx sdk.Context, obj types.Account) { +func (k *keeper) SaveAccount(ctx sdk.Context, obj v1.Account) { k.saveAccount(ctx, &obj) } -func (k *keeper) SavePayment(ctx sdk.Context, obj types.FractionalPayment) { +func (k *keeper) SavePayment(ctx sdk.Context, obj v1.FractionalPayment) { k.savePayment(ctx, &obj) } -func (k *keeper) WithAccounts(ctx sdk.Context, fn func(types.Account) bool) { +func (k *keeper) WithAccounts(ctx sdk.Context, fn func(v1.Account) bool) { store := ctx.KVStore(k.skey) - iter := sdk.KVStorePrefixIterator(store, types.AccountKeyPrefix()) + iter := sdk.KVStorePrefixIterator(store, v1.AccountKeyPrefix()) defer func() { _ = iter.Close() }() for ; iter.Valid(); iter.Next() { - var val types.Account + var val v1.Account k.cdc.MustUnmarshal(iter.Value(), &val) if stop := fn(val); stop { break @@ -384,16 +400,16 @@ func (k *keeper) WithAccounts(ctx sdk.Context, fn func(types.Account) bool) { } } -func (k *keeper) WithPayments(ctx sdk.Context, fn func(types.FractionalPayment) bool) { +func (k *keeper) WithPayments(ctx sdk.Context, fn func(v1.FractionalPayment) bool) { store := ctx.KVStore(k.skey) - iter := sdk.KVStorePrefixIterator(store, types.PaymentKeyPrefix()) + iter := sdk.KVStorePrefixIterator(store, v1.PaymentKeyPrefix()) defer func() { _ = iter.Close() }() for ; iter.Valid(); iter.Next() { - var val types.FractionalPayment + var val v1.FractionalPayment k.cdc.MustUnmarshal(iter.Value(), &val) if stop := fn(val); stop { break @@ -401,14 +417,14 @@ func (k *keeper) WithPayments(ctx sdk.Context, fn func(types.FractionalPayment) } } -func (k *keeper) doAccountSettle(ctx sdk.Context, id types.AccountID) (types.Account, []types.FractionalPayment, bool, error) { +func (k *keeper) doAccountSettle(ctx sdk.Context, id v1.AccountID) (v1.Account, []v1.FractionalPayment, bool, error) { account, err := k.GetAccount(ctx, id) if err != nil { return account, nil, false, err } - if account.State != types.AccountOpen { - return account, nil, false, types.ErrAccountClosed + if account.State != v1.AccountOpen { + return account, nil, false, v1.ErrAccountClosed } heightDelta := sdk.NewInt(ctx.BlockHeight() - account.SettledAt) @@ -438,15 +454,15 @@ func (k *keeper) doAccountSettle(ctx sdk.Context, id types.AccountID) (types.Acc owner := sdk.MustAccAddressFromBech32(account.Owner) depositor := sdk.MustAccAddressFromBech32(account.Depositor) - msg := &dtypes.MsgDepositDeployment{Amount: sdk.NewCoin(account.Balance.Denom, sdk.NewInt(0))} + msg := &dv1.MsgDepositDeployment{Amount: sdk.NewCoin(account.Balance.Denom, sdk.NewInt(0))} - authz, _ := k.authzKeeper.GetCleanAuthorization(ctx, owner, depositor, sdk.MsgTypeURL(msg)) + authz, _ := k.authzKeeper.GetAuthorization(ctx, owner, depositor, sdk.MsgTypeURL(msg)) // if authorization has been revoked or expired it cannot be used anymore // send coins back to the owner if authz == nil { withdrawal := sdk.NewCoin(account.Balance.Denom, account.Funds.Amount.TruncateInt()) - if err := k.bkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, depositor, sdk.NewCoins(withdrawal)); err != nil { + if err := k.bkeeper.SendCoinsFromModuleToAccount(ctx, v1.ModuleName, depositor, sdk.NewCoins(withdrawal)); err != nil { ctx.Logger().Error("account withdraw", "err", err, "id", account.ID) return account, payments, overdrawn, err } @@ -475,14 +491,14 @@ func (k *keeper) doAccountSettle(ctx sdk.Context, id types.AccountID) (types.Acc account, payments, amountRemaining = accountSettleDistributeWeighted(account, payments, blockRate, amountRemaining) if amountRemaining.Amount.GT(sdk.NewDec(1)) { - return account, payments, false, fmt.Errorf("%w: Invalid settlement: %v remains", types.ErrInvalidSettlement, amountRemaining) + return account, payments, false, fmt.Errorf("%w: Invalid settlement: %v remains", v1.ErrInvalidSettlement, amountRemaining) } // save objects - account.State = types.AccountOverdrawn + account.State = v1.AccountOverdrawn k.saveAccount(ctx, &account) for idx := range payments { - payments[idx].State = types.PaymentOverdrawn + payments[idx].State = v1.PaymentOverdrawn k.savePayment(ctx, &payments[idx]) if err := k.paymentWithdraw(ctx, &payments[idx]); err != nil { return account, payments, false, err @@ -503,30 +519,30 @@ func (k *keeper) doAccountSettle(ctx sdk.Context, id types.AccountID) (types.Acc return account, payments, true, nil } -func (k *keeper) saveAccount(ctx sdk.Context, obj *types.Account) { +func (k *keeper) saveAccount(ctx sdk.Context, obj *v1.Account) { store := ctx.KVStore(k.skey) key := accountKey(obj.ID) store.Set(key, k.cdc.MustMarshal(obj)) } -func (k *keeper) savePayment(ctx sdk.Context, obj *types.FractionalPayment) { +func (k *keeper) savePayment(ctx sdk.Context, obj *v1.FractionalPayment) { store := ctx.KVStore(k.skey) key := paymentKey(obj.AccountID, obj.PaymentID) store.Set(key, k.cdc.MustMarshal(obj)) } -func (k *keeper) accountPayments(ctx sdk.Context, id types.AccountID) []types.FractionalPayment { +func (k *keeper) accountPayments(ctx sdk.Context, id v1.AccountID) []v1.FractionalPayment { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, accountPaymentsKey(id)) - var payments []types.FractionalPayment + var payments []v1.FractionalPayment defer func() { _ = iter.Close() }() for ; iter.Valid(); iter.Next() { - var val types.FractionalPayment + var val v1.FractionalPayment k.cdc.MustUnmarshal(iter.Value(), &val) payments = append(payments, val) } @@ -534,12 +550,12 @@ func (k *keeper) accountPayments(ctx sdk.Context, id types.AccountID) []types.Fr return payments } -func (k *keeper) accountOpenPayments(ctx sdk.Context, id types.AccountID) []types.FractionalPayment { +func (k *keeper) accountOpenPayments(ctx sdk.Context, id v1.AccountID) []v1.FractionalPayment { allPayments := k.accountPayments(ctx, id) - payments := make([]types.FractionalPayment, 0, len(allPayments)) + payments := make([]v1.FractionalPayment, 0, len(allPayments)) for _, payment := range allPayments { - if payment.State != types.PaymentOpen { + if payment.State != v1.PaymentOpen { continue } payments = append(payments, payment) @@ -548,7 +564,7 @@ func (k *keeper) accountOpenPayments(ctx sdk.Context, id types.AccountID) []type return payments } -func (k *keeper) accountWithdraw(ctx sdk.Context, obj *types.Account) error { +func (k *keeper) accountWithdraw(ctx sdk.Context, obj *v1.Account) error { if obj.Balance.Amount.LT(sdk.NewDec(1)) && obj.Funds.Amount.LT(sdk.NewDec(1)) { return nil } @@ -560,7 +576,7 @@ func (k *keeper) accountWithdraw(ctx sdk.Context, obj *types.Account) error { if !obj.Balance.Amount.LT(sdk.NewDec(1)) { withdrawal := sdk.NewCoin(obj.Balance.Denom, obj.Balance.Amount.TruncateInt()) - if err = k.bkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, sdk.NewCoins(withdrawal)); err != nil { + if err = k.bkeeper.SendCoinsFromModuleToAccount(ctx, v1.ModuleName, owner, sdk.NewCoins(withdrawal)); err != nil { ctx.Logger().Error("account withdraw", "err", err, "id", obj.ID) return err } @@ -574,21 +590,21 @@ func (k *keeper) accountWithdraw(ctx sdk.Context, obj *types.Account) error { } withdrawal := sdk.NewCoin(obj.Balance.Denom, obj.Funds.Amount.TruncateInt()) - if err = k.bkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, depositor, sdk.NewCoins(withdrawal)); err != nil { + if err = k.bkeeper.SendCoinsFromModuleToAccount(ctx, v1.ModuleName, depositor, sdk.NewCoins(withdrawal)); err != nil { ctx.Logger().Error("account withdraw", "err", err, "id", obj.ID) return err } obj.Funds = obj.Funds.Sub(sdk.NewDecCoinFromCoin(withdrawal)) - msg := &dtypes.MsgDepositDeployment{Amount: sdk.NewCoin(obj.Balance.Denom, sdk.NewInt(0))} + msg := &dv1.MsgDepositDeployment{Amount: sdk.NewCoin(obj.Balance.Denom, sdk.NewInt(0))} // Funds field is solely to track deposits via authz. // check if there is active deployment authorization from given depositor // if exists, increase allowed authz deposit by remainder in the Funds, it will allow owner to reuse active authz // without asking for renew. - authorization, expiration := k.authzKeeper.GetCleanAuthorization(ctx, owner, depositor, sdk.MsgTypeURL(msg)) - dauthz, valid := authorization.(*dtypes.DepositDeploymentAuthorization) + authorization, expiration := k.authzKeeper.GetAuthorization(ctx, owner, depositor, sdk.MsgTypeURL(msg)) + dauthz, valid := authorization.(*dv1.DepositAuthorization) if valid && authorization != nil { dauthz.SpendLimit = dauthz.SpendLimit.Add(withdrawal) err = k.authzKeeper.SaveGrant(ctx, owner, depositor, dauthz, expiration) @@ -603,7 +619,7 @@ func (k *keeper) accountWithdraw(ctx sdk.Context, obj *types.Account) error { return nil } -func (k *keeper) paymentWithdraw(ctx sdk.Context, obj *types.FractionalPayment) error { +func (k *keeper) paymentWithdraw(ctx sdk.Context, obj *v1.FractionalPayment) error { owner, err := sdk.AccAddressFromBech32(obj.Owner) if err != nil { return err @@ -626,7 +642,7 @@ func (k *keeper) paymentWithdraw(ctx sdk.Context, obj *types.FractionalPayment) } if !earnings.IsZero() { - if err := k.bkeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, sdk.NewCoins(earnings)); err != nil { + if err := k.bkeeper.SendCoinsFromModuleToAccount(ctx, v1.ModuleName, owner, sdk.NewCoins(earnings)); err != nil { ctx.Logger().Error("payment withdraw - earnings", "err", err, "account", obj.AccountID, "payment", obj.PaymentID) return err } @@ -648,7 +664,7 @@ func (k *keeper) sendFeeToCommunityPool(ctx sdk.Context, fee sdk.Coin) error { } // see https://github.com/cosmos/cosmos-sdk/blob/c2a07cea272a7878b5bc2ec160eb58ca83794214/x/distribution/keeper/keeper.go#L251-L263 - if err := k.bkeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, distrtypes.ModuleName, sdk.NewCoins(fee)); err != nil { + if err := k.bkeeper.SendCoinsFromModuleToModule(ctx, v1.ModuleName, distrtypes.ModuleName, sdk.NewCoins(fee)); err != nil { return err } @@ -661,13 +677,13 @@ func (k *keeper) sendFeeToCommunityPool(ctx sdk.Context, fee sdk.Coin) error { } func accountSettleFullBlocks( - account types.Account, - payments []types.FractionalPayment, - heightDelta sdk.Int, + account v1.Account, + payments []v1.FractionalPayment, + heightDelta math.Int, blockRate sdk.DecCoin, ) ( - types.Account, - []types.FractionalPayment, + v1.Account, + []v1.FractionalPayment, bool, sdk.DecCoin, ) { @@ -712,13 +728,13 @@ func accountSettleFullBlocks( } func accountSettleDistributeWeighted( - account types.Account, - payments []types.FractionalPayment, + account v1.Account, + payments []v1.FractionalPayment, blockRate sdk.DecCoin, amountRemaining sdk.DecCoin, ) ( - types.Account, - []types.FractionalPayment, + v1.Account, + []v1.FractionalPayment, sdk.DecCoin, ) { actualTransferred := sdk.ZeroDec() diff --git a/x/escrow/keeper/keeper_settle_test.go b/x/escrow/keeper/keeper_settle_test.go index 971ae88a9f..5a822d4b85 100644 --- a/x/escrow/keeper/keeper_settle_test.go +++ b/x/escrow/keeper/keeper_settle_test.go @@ -3,10 +3,12 @@ package keeper import ( "testing" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + "pkg.akt.dev/go/node/escrow/v1" ) const denom = "uakt" @@ -246,20 +248,20 @@ type distTestConfig struct { overdrawn bool } -func setupDistTest(cfg distTestConfig) (types.Account, []types.FractionalPayment, sdk.Int, sdk.DecCoin) { - account := types.Account{ +func setupDistTest(cfg distTestConfig) (v1.Account, []v1.FractionalPayment, sdkmath.Int, sdk.DecCoin) { + account := v1.Account{ Balance: sdk.NewInt64DecCoin(denom, cfg.balanceStart), Transferred: sdk.NewInt64DecCoin(denom, 0), Funds: sdk.NewInt64DecCoin(denom, cfg.fundsStart), } - payments := make([]types.FractionalPayment, 0, len(cfg.rates)) + payments := make([]v1.FractionalPayment, 0, len(cfg.rates)) blockRate := int64(0) for _, rate := range cfg.rates { blockRate += rate - payments = append(payments, types.FractionalPayment{ + payments = append(payments, v1.FractionalPayment{ Rate: sdk.NewInt64DecCoin(denom, rate), Balance: sdk.NewInt64DecCoin(denom, 0), }) diff --git a/x/escrow/keeper/keeper_test.go b/x/escrow/keeper/keeper_test.go index 4e91454823..8769b1baab 100644 --- a/x/escrow/keeper/keeper_test.go +++ b/x/escrow/keeper/keeper_test.go @@ -7,12 +7,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + "pkg.akt.dev/go/node/escrow/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/cosmos/mocks" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/escrow/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/cosmos/mocks" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/escrow/keeper" ) func Test_AccountCreate(t *testing.T) { @@ -24,21 +24,21 @@ func Test_AccountCreate(t *testing.T) { // create account bkeeper. - On("SendCoinsFromAccountToModule", ctx, owner, types.ModuleName, sdk.NewCoins(amt)). + On("SendCoinsFromAccountToModule", ctx, owner, v1.ModuleName, sdk.NewCoins(amt)). Return(nil) assert.NoError(t, keeper.AccountCreate(ctx, id, owner, owner, amt)) // deposit more tokens ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 10) bkeeper. - On("SendCoinsFromAccountToModule", ctx, owner, types.ModuleName, sdk.NewCoins(amt2)). + On("SendCoinsFromAccountToModule", ctx, owner, v1.ModuleName, sdk.NewCoins(amt2)). Return(nil) assert.NoError(t, keeper.AccountDeposit(ctx, id, owner, amt2)) // close account ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 10) bkeeper. - On("SendCoinsFromModuleToAccount", ctx, types.ModuleName, owner, sdk.NewCoins(amt.Add(amt2))). + On("SendCoinsFromModuleToAccount", ctx, v1.ModuleName, owner, sdk.NewCoins(amt.Add(amt2))). Return(nil) assert.NoError(t, keeper.AccountClose(ctx, id)) @@ -61,7 +61,7 @@ func Test_PaymentCreate(t *testing.T) { // create account bkeeper. - On("SendCoinsFromAccountToModule", ctx, aowner, types.ModuleName, sdk.NewCoins(amt)). + On("SendCoinsFromAccountToModule", ctx, aowner, v1.ModuleName, sdk.NewCoins(amt)). Return(nil) assert.NoError(t, keeper.AccountCreate(ctx, aid, aowner, aowner, amt)) @@ -78,7 +78,7 @@ func Test_PaymentCreate(t *testing.T) { blkdelta := int64(10) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + blkdelta) bkeeper. - On("SendCoinsFromModuleToAccount", ctx, types.ModuleName, powner, sdk.NewCoins(testutil.AkashCoin(t, rate.Amount.Int64()*blkdelta))). + On("SendCoinsFromModuleToAccount", ctx, v1.ModuleName, powner, sdk.NewCoins(testutil.AkashCoin(t, rate.Amount.Int64()*blkdelta))). Return(nil) assert.NoError(t, keeper.PaymentWithdraw(ctx, aid, pid)) @@ -87,14 +87,14 @@ func Test_PaymentCreate(t *testing.T) { require.NoError(t, err) require.Equal(t, ctx.BlockHeight(), acct.SettledAt) - require.Equal(t, types.AccountOpen, acct.State) + require.Equal(t, v1.AccountOpen, acct.State) require.Equal(t, testutil.AkashDecCoin(t, amt.Amount.Int64()-rate.Amount.Int64()*ctx.BlockHeight()), acct.Balance) require.Equal(t, testutil.AkashDecCoin(t, rate.Amount.Int64()*ctx.BlockHeight()), acct.Transferred) payment, err := keeper.GetPayment(ctx, aid, pid) require.NoError(t, err) - require.Equal(t, types.PaymentOpen, payment.State) + require.Equal(t, v1.PaymentOpen, payment.State) require.Equal(t, testutil.AkashCoin(t, rate.Amount.Int64()*ctx.BlockHeight()), payment.Withdrawn) require.Equal(t, testutil.AkashDecCoin(t, 0), payment.Balance) } @@ -103,7 +103,7 @@ func Test_PaymentCreate(t *testing.T) { blkdelta = 20 ctx = ctx.WithBlockHeight(ctx.BlockHeight() + blkdelta) bkeeper. - On("SendCoinsFromModuleToAccount", ctx, types.ModuleName, powner, sdk.NewCoins(testutil.AkashCoin(t, rate.Amount.Int64()*blkdelta))). + On("SendCoinsFromModuleToAccount", ctx, v1.ModuleName, powner, sdk.NewCoins(testutil.AkashCoin(t, rate.Amount.Int64()*blkdelta))). Return(nil) assert.NoError(t, keeper.PaymentClose(ctx, aid, pid)) @@ -112,14 +112,14 @@ func Test_PaymentCreate(t *testing.T) { require.NoError(t, err) require.Equal(t, ctx.BlockHeight(), acct.SettledAt) - require.Equal(t, types.AccountOpen, acct.State) + require.Equal(t, v1.AccountOpen, acct.State) require.Equal(t, testutil.AkashDecCoin(t, amt.Amount.Int64()-rate.Amount.Int64()*ctx.BlockHeight()), acct.Balance) require.Equal(t, testutil.AkashDecCoin(t, rate.Amount.Int64()*ctx.BlockHeight()), acct.Transferred) payment, err := keeper.GetPayment(ctx, aid, pid) require.NoError(t, err) - require.Equal(t, types.PaymentClosed, payment.State) + require.Equal(t, v1.PaymentClosed, payment.State) require.Equal(t, testutil.AkashCoin(t, rate.Amount.Int64()*ctx.BlockHeight()), payment.Withdrawn) require.Equal(t, testutil.AkashDecCoin(t, 0), payment.Balance) } @@ -134,7 +134,7 @@ func Test_PaymentCreate(t *testing.T) { // closing the account transfers all remaining funds bkeeper. - On("SendCoinsFromModuleToAccount", ctx, types.ModuleName, aowner, sdk.NewCoins(testutil.AkashCoin(t, amt.Amount.Int64()-rate.Amount.Int64()*30))). + On("SendCoinsFromModuleToAccount", ctx, v1.ModuleName, aowner, sdk.NewCoins(testutil.AkashCoin(t, amt.Amount.Int64()-rate.Amount.Int64()*30))). Return(nil) assert.NoError(t, keeper.AccountClose(ctx, aid)) } @@ -150,7 +150,7 @@ func Test_Payment_Overdraw(t *testing.T) { // create account bkeeper. - On("SendCoinsFromAccountToModule", ctx, aowner, types.ModuleName, sdk.NewCoins(amt)). + On("SendCoinsFromAccountToModule", ctx, aowner, v1.ModuleName, sdk.NewCoins(amt)). Return(nil) assert.NoError(t, keeper.AccountCreate(ctx, aid, aowner, aowner, amt)) @@ -161,7 +161,7 @@ func Test_Payment_Overdraw(t *testing.T) { blkdelta := int64(1000/10 + 1) ctx = ctx.WithBlockHeight(ctx.BlockHeight() + blkdelta) bkeeper. - On("SendCoinsFromModuleToAccount", ctx, types.ModuleName, powner, sdk.NewCoins(testutil.AkashCoin(t, 1000))). + On("SendCoinsFromModuleToAccount", ctx, v1.ModuleName, powner, sdk.NewCoins(testutil.AkashCoin(t, 1000))). Return(nil) assert.NoError(t, keeper.PaymentWithdraw(ctx, aid, pid)) @@ -170,14 +170,14 @@ func Test_Payment_Overdraw(t *testing.T) { require.NoError(t, err) assert.Equal(t, ctx.BlockHeight(), acct.SettledAt) - assert.Equal(t, types.AccountOverdrawn, acct.State) + assert.Equal(t, v1.AccountOverdrawn, acct.State) assert.Equal(t, testutil.AkashDecCoin(t, 0), acct.Balance) assert.Equal(t, sdk.NewDecCoinFromCoin(amt), acct.Transferred) payment, err := keeper.GetPayment(ctx, aid, pid) assert.NoError(t, err) - assert.Equal(t, types.PaymentOverdrawn, payment.State) + assert.Equal(t, v1.PaymentOverdrawn, payment.State) assert.Equal(t, amt, payment.Withdrawn) assert.Equal(t, testutil.AkashDecCoin(t, 0), payment.Balance) } @@ -196,7 +196,7 @@ func Test_PaymentCreate_later(t *testing.T) { // create account bkeeper. - On("SendCoinsFromAccountToModule", ctx, aowner, types.ModuleName, sdk.NewCoins(amt)). + On("SendCoinsFromAccountToModule", ctx, aowner, v1.ModuleName, sdk.NewCoins(amt)). Return(nil) assert.NoError(t, keeper.AccountCreate(ctx, aid, aowner, aowner, amt)) @@ -213,9 +213,9 @@ func Test_PaymentCreate_later(t *testing.T) { } } -func genAccountID(t testing.TB) types.AccountID { +func genAccountID(t testing.TB) v1.AccountID { t.Helper() - return types.AccountID{ + return v1.AccountID{ Scope: "test", XID: testutil.Name(t, "acct"), } diff --git a/x/escrow/keeper/key.go b/x/escrow/keeper/key.go index a6c573ab0f..f8a5d22cf0 100644 --- a/x/escrow/keeper/key.go +++ b/x/escrow/keeper/key.go @@ -3,13 +3,13 @@ package keeper import ( "bytes" - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + "pkg.akt.dev/go/node/escrow/v1" ) -func accountKey(id types.AccountID) []byte { +func accountKey(id v1.AccountID) []byte { // TODO: validate scope, xid buf := bytes.Buffer{} - buf.Write(types.AccountKeyPrefix()) + buf.Write(v1.AccountKeyPrefix()) buf.WriteRune('/') buf.WriteString(id.Scope) buf.WriteRune('/') @@ -17,10 +17,10 @@ func accountKey(id types.AccountID) []byte { return buf.Bytes() } -func accountPaymentsKey(id types.AccountID) []byte { +func accountPaymentsKey(id v1.AccountID) []byte { // TODO: validate scope, xid, pid buf := bytes.Buffer{} - buf.Write(types.PaymentKeyPrefix()) + buf.Write(v1.PaymentKeyPrefix()) buf.WriteRune('/') buf.WriteString(id.Scope) buf.WriteRune('/') @@ -29,10 +29,10 @@ func accountPaymentsKey(id types.AccountID) []byte { return buf.Bytes() } -func paymentKey(id types.AccountID, pid string) []byte { +func paymentKey(id v1.AccountID, pid string) []byte { // TODO: validate scope, xid, pid buf := bytes.Buffer{} - buf.Write(types.PaymentKeyPrefix()) + buf.Write(v1.PaymentKeyPrefix()) buf.WriteRune('/') buf.WriteString(id.Scope) buf.WriteRune('/') diff --git a/x/escrow/keeper/querier.go b/x/escrow/keeper/querier.go index 670f23ce55..e57e511c3f 100644 --- a/x/escrow/keeper/querier.go +++ b/x/escrow/keeper/querier.go @@ -1,9 +1,9 @@ package keeper import ( - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + types "pkg.akt.dev/go/node/escrow/v1" ) -func NewQuerier(k Keeper) types.QueryServer { +func NewQuerier(_ Keeper) types.QueryServer { return nil } diff --git a/x/escrow/module.go b/x/escrow/module.go index ca05c438ac..547fc14c5b 100644 --- a/x/escrow/module.go +++ b/x/escrow/module.go @@ -4,37 +4,31 @@ import ( "context" "encoding/json" "fmt" - "math/rand" - "github.com/gogo/protobuf/grpc" + "github.com/cosmos/gogoproto/grpc" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - sim "github.com/cosmos/cosmos-sdk/types/simulation" + v1 "pkg.akt.dev/go/node/escrow/v1" - v1beta1types "github.com/akash-network/akash-api/go/node/escrow/v1beta1" - v1beta2types "github.com/akash-network/akash-api/go/node/escrow/v1beta2" - types "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/escrow/client/cli" - "github.com/akash-network/node/x/escrow/client/rest" - "github.com/akash-network/node/x/escrow/keeper" - "github.com/akash-network/node/x/escrow/query" + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/x/escrow/client/cli" + "pkg.akt.dev/akashd/x/escrow/client/rest" + "pkg.akt.dev/akashd/x/escrow/keeper" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModuleSimulation{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + // _ module.AppModuleSimulation = AppModuleSimulation{} ) // AppModuleBasic defines the basic application module used by the provider module. @@ -44,19 +38,19 @@ type AppModuleBasic struct { // Name returns provider module's name func (AppModuleBasic) Name() string { - return types.ModuleName + return v1.ModuleName } // RegisterLegacyAminoCodec registers the provider module's types for the given codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) + v1.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(registry) - v1beta2types.RegisterInterfaces(registry) - v1beta1types.RegisterInterfaces(registry) + v1.RegisterInterfaces(registry) + // v1beta2types.RegisterInterfaces(registry) + // v1beta1types.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the provider @@ -71,11 +65,11 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo return nil } - var data types.GenesisState + var data v1.GenesisState err := cdc.UnmarshalJSON(bz, &data) if err != nil { - return fmt.Errorf("failed to unmarshal %s genesis state: %v", types.ModuleName, err) + return fmt.Errorf("failed to unmarshal %s genesis state: %v", v1.ModuleName, err) } return ValidateGenesis(&data) @@ -83,12 +77,12 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo // RegisterRESTRoutes registers rest routes for this module func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(clientCtx, rtr, types.StoreKey) + rest.RegisterRoutes(clientCtx, rtr, v1.StoreKey) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the provider module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + err := v1.RegisterQueryHandlerClient(context.Background(), mux, v1.NewQueryClient(clientCtx)) if err != nil { panic(fmt.Sprintf("couldn't register provider grpc routes: %s", err.Error())) } @@ -96,7 +90,7 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *r // RegisterGRPCRoutes registers the gRPC Gateway routes for the provider module. func (AppModuleBasic) RegisterGRPCRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + err := v1.RegisterQueryHandlerClient(context.Background(), mux, v1.NewQueryClient(clientCtx)) if err != nil { panic(fmt.Sprintf("couldn't register audit grpc routes: %s", err.Error())) } @@ -113,8 +107,8 @@ func (AppModuleBasic) GetTxCmd() *cobra.Command { } // GetQueryClient returns a new query client for this module -func (AppModuleBasic) GetQueryClient(clientCtx client.Context) types.QueryClient { - return types.NewQueryClient(clientCtx) +func (AppModuleBasic) GetQueryClient(clientCtx client.Context) v1.QueryClient { + return v1.NewQueryClient(clientCtx) } // AppModule implements an application module for the audit module. @@ -133,31 +127,31 @@ func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { // Name returns the provider module name func (AppModule) Name() string { - return types.ModuleName + return v1.ModuleName } // RegisterInvariants registers module invariants func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} -// Route returns the message routing key for the audit module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, nil) -} +// // Route returns the message routing key for the audit module. +// func (am AppModule) Route() sdk.Route { +// return sdk.NewRoute(types.RouterKey, nil) +// } // QuerierRoute returns the audit module's querier route name. func (am AppModule) QuerierRoute() string { - return types.ModuleName + return v1.ModuleName } -// LegacyQuerierHandler returns the sdk.Querier for audit module -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return query.NewQuerier(am.keeper, legacyQuerierCdc) -} +// // LegacyQuerierHandler returns the sdk.Querier for audit module +// func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +// return query.NewQuerier(am.keeper, legacyQuerierCdc) +// } // RegisterServices registers the module's servicess func (am AppModule) RegisterServices(cfg module.Configurator) { querier := keeper.NewQuerier(am.keeper) - types.RegisterQueryServer(cfg.QueryServer(), querier) + v1.RegisterQueryServer(cfg.QueryServer(), querier) utypes.ModuleMigrations(ModuleName, am.keeper, func(name string, forVersion uint64, handler module.MigrationHandler) { if err := cfg.RegisterMigration(name, forVersion, handler); err != nil { @@ -170,7 +164,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // module-specific GRPC queries. func (am AppModule) RegisterQueryService(server grpc.Server) { querier := keeper.NewQuerier(am.keeper) - types.RegisterQueryServer(server, querier) + v1.RegisterQueryServer(server, querier) } // BeginBlock performs no-op @@ -185,7 +179,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val // InitGenesis performs genesis initialization for the audit module. It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState + var genesisState v1.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) return InitGenesis(ctx, am.keeper, &genesisState) } @@ -216,28 +210,28 @@ func NewAppModuleSimulation(k keeper.Keeper) AppModuleSimulation { } } -// AppModuleSimulation functions -// GenerateGenesisState creates a randomized GenState of the staking module. -func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { - // simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModuleSimulation) RandomizedParams(r *rand.Rand) []sim.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for staking module's types -func (AppModuleSimulation) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - -} - -// WeightedOperations returns the all the staking module operations with their respective weights. -func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation { - return nil -} +// // AppModuleSimulation functions +// // GenerateGenesisState creates a randomized GenState of the staking module. +// func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { +// // simulation.RandomizedGenState(simState) +// } +// +// // ProposalContents doesn't return any content functions for governance proposals. +// func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { +// return nil +// } +// +// // RandomizedParams creates randomized staking param changes for the simulator. +// func (AppModuleSimulation) RandomizedParams(r *rand.Rand) []sim.ParamChange { +// return nil +// } +// +// // RegisterStoreDecoder registers a decoder for staking module's types +// func (AppModuleSimulation) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +// +// } +// +// // WeightedOperations returns the all the staking module operations with their respective weights. +// func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation { +// return nil +// } diff --git a/x/escrow/query/querier.go b/x/escrow/query/querier.go index 7824bb2651..262c23e8d6 100644 --- a/x/escrow/query/querier.go +++ b/x/escrow/query/querier.go @@ -1,12 +1,12 @@ package query -import ( - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/akash-network/node/x/escrow/keeper" -) - -func NewQuerier(keeper keeper.Keeper, cdc *codec.LegacyAmino) sdk.Querier { - return nil -} +// import ( +// "github.com/cosmos/cosmos-sdk/codec" +// sdk "github.com/cosmos/cosmos-sdk/types" +// +// "pkg.akt.dev/akashd/x/escrow/keeper" +// ) +// +// func NewQuerier(keeper keeper.Keeper, cdc *codec.LegacyAmino) sdk.Querier { +// return nil +// } diff --git a/x/gov/alias.go b/x/gov/alias.go index c30bd8fdef..75ae32f168 100644 --- a/x/gov/alias.go +++ b/x/gov/alias.go @@ -1,9 +1,9 @@ package provider import ( - types "github.com/akash-network/akash-api/go/node/gov/v1beta3" + types "pkg.akt.dev/go/node/gov/v1beta3" - "github.com/akash-network/node/x/gov/keeper" + "pkg.akt.dev/akashd/x/gov/keeper" ) const ( diff --git a/x/gov/genesis.go b/x/gov/genesis.go index 2b7b7638c7..e6a79ac602 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -3,13 +3,13 @@ package provider import ( "encoding/json" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - types "github.com/akash-network/akash-api/go/node/gov/v1beta3" + types "pkg.akt.dev/go/node/gov/v1beta3" - "github.com/akash-network/node/x/gov/keeper" + "pkg.akt.dev/akashd/x/gov/keeper" ) // ValidateGenesis does validation check of the Genesis and returns error in case of failure diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 001f4a96c7..ac7fef73a0 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - types "github.com/akash-network/akash-api/go/node/gov/v1beta3" + types "pkg.akt.dev/go/node/gov/v1beta3" ) type IKeeper interface { diff --git a/x/gov/module.go b/x/gov/module.go index c1717ab24a..217c761464 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -18,11 +18,11 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/types/simulation" - types "github.com/akash-network/akash-api/go/node/gov/v1beta3" + types "pkg.akt.dev/go/node/gov/v1beta3" - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/gov/keeper" - "github.com/akash-network/node/x/gov/simulation" + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/x/gov/keeper" + "pkg.akt.dev/akashd/x/gov/simulation" ) var ( diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 673784f54c..79bd743183 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -3,7 +3,7 @@ package simulation import ( "github.com/cosmos/cosmos-sdk/types/module" - types "github.com/akash-network/akash-api/go/node/gov/v1beta3" + types "pkg.akt.dev/go/node/gov/v1beta3" ) // RandomizedGenState generates a random GenesisState for supply diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 2d71a519bf..d286a74350 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -5,7 +5,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/akash-network/node/x/gov/keeper" + "pkg.akt.dev/akashd/x/gov/keeper" ) // WeightedOperations returns all the operations from the module with their respective weights diff --git a/x/inflation/alias.go b/x/inflation/alias.go index 048570023a..b6503c959f 100644 --- a/x/inflation/alias.go +++ b/x/inflation/alias.go @@ -1,9 +1,9 @@ package inflation import ( - types "github.com/akash-network/akash-api/go/node/inflation/v1beta3" + types "pkg.akt.dev/go/node/inflation/v1beta3" - "github.com/akash-network/node/x/inflation/keeper" + "pkg.akt.dev/akashd/x/inflation/keeper" ) const ( diff --git a/x/inflation/genesis.go b/x/inflation/genesis.go index 1743dcd882..e5fe7ca99e 100644 --- a/x/inflation/genesis.go +++ b/x/inflation/genesis.go @@ -6,11 +6,11 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" - types "github.com/akash-network/akash-api/go/node/inflation/v1beta3" + types "pkg.akt.dev/go/node/inflation/v1beta3" - "github.com/akash-network/node/x/inflation/keeper" + "pkg.akt.dev/akashd/x/inflation/keeper" ) // ValidateGenesis does validation check of the Genesis and return error in case of failure diff --git a/x/inflation/keeper/keeper.go b/x/inflation/keeper/keeper.go index dc55f6d6eb..96da8a1509 100644 --- a/x/inflation/keeper/keeper.go +++ b/x/inflation/keeper/keeper.go @@ -6,7 +6,7 @@ import ( paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - types "github.com/akash-network/akash-api/go/node/inflation/v1beta3" + types "pkg.akt.dev/go/node/inflation/v1beta3" ) type IKeeper interface { diff --git a/x/inflation/module.go b/x/inflation/module.go index fd90a2d6c4..343843da9b 100644 --- a/x/inflation/module.go +++ b/x/inflation/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -18,11 +18,11 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/types/simulation" - types "github.com/akash-network/akash-api/go/node/inflation/v1beta3" + types "pkg.akt.dev/go/node/inflation/v1beta3" - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/inflation/keeper" - "github.com/akash-network/node/x/inflation/simulation" + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/x/inflation/keeper" + "pkg.akt.dev/akashd/x/inflation/simulation" ) // type check to ensure the interface is properly implemented diff --git a/x/inflation/simulation/genesis.go b/x/inflation/simulation/genesis.go index 4ae77027de..2e8a70a2ea 100644 --- a/x/inflation/simulation/genesis.go +++ b/x/inflation/simulation/genesis.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - types "github.com/akash-network/akash-api/go/node/inflation/v1beta3" + types "pkg.akt.dev/go/node/inflation/v1beta3" ) // RandomizedGenState generates a random GenesisState for supply diff --git a/x/market/alias.go b/x/market/alias.go index 322a46ab0b..afcbfe8e7f 100644 --- a/x/market/alias.go +++ b/x/market/alias.go @@ -1,9 +1,9 @@ package market import ( - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta5" - "github.com/akash-network/node/x/market/keeper" + "pkg.akt.dev/akashd/x/market/keeper" ) const ( diff --git a/x/market/client/cli/bid.go b/x/market/client/cli/bid.go index cd2562e282..8c26275ce9 100644 --- a/x/market/client/cli/bid.go +++ b/x/market/client/cli/bid.go @@ -2,12 +2,13 @@ package cli import ( sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + "pkg.akt.dev/go/cli" - aclient "github.com/akash-network/node/client" + types "pkg.akt.dev/go/node/market/v1beta5" + + aclient "pkg.akt.dev/akashd/client" ) func cmdGetBids() *cobra.Command { @@ -27,7 +28,7 @@ func cmdGetBids() *cobra.Command { return err } - bfilters, err := BidFiltersFromFlags(cmd.Flags()) + bfilters, err := cli.BidFiltersFromFlags(cmd.Flags()) if err != nil { return err } @@ -51,9 +52,9 @@ func cmdGetBids() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, "bids") - AddBidFilterFlags(cmd.Flags()) + cli.AddQueryFlagsToCmd(cmd) + cli.AddPaginationFlagsToCmd(cmd, "bids") + cli.AddBidFilterFlags(cmd.Flags()) return cmd } @@ -76,7 +77,7 @@ func cmdGetBid() *cobra.Command { return err } - bidID, err := BidIDFromFlags(cmd.Flags()) + bidID, err := cli.BidIDFromFlags(cmd.Flags()) if err != nil { return err } @@ -90,9 +91,9 @@ func cmdGetBid() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) - AddQueryBidIDFlags(cmd.Flags()) - MarkReqBidIDFlags(cmd) + cli.AddQueryFlagsToCmd(cmd) + cli.AddQueryBidIDFlags(cmd.Flags()) + cli.MarkReqBidIDFlags(cmd) return cmd } diff --git a/x/market/client/cli/cli_test.go b/x/market/client/cli/cli_test.go index d93046861b..9bee84025d 100644 --- a/x/market/client/cli/cli_test.go +++ b/x/market/client/cli/cli_test.go @@ -6,25 +6,27 @@ import ( "path/filepath" "testing" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta5" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/network" - ccli "github.com/akash-network/node/x/cert/client/cli" - dcli "github.com/akash-network/node/x/deployment/client/cli" - "github.com/akash-network/node/x/market/client/cli" - pcli "github.com/akash-network/node/x/provider/client/cli" + "pkg.akt.dev/go/cli" + + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/network" + ccli "pkg.akt.dev/akashd/x/cert/client/cli" + dcli "pkg.akt.dev/akashd/x/deployment/client/cli" + mcli "pkg.akt.dev/akashd/x/market/client/cli" + pcli "pkg.akt.dev/akashd/x/provider/client/cli" ) type IntegrationTestSuite struct { @@ -67,7 +69,7 @@ func (s *IntegrationTestSuite) SetupSuite() { val.ClientCtx, val.Address, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -93,7 +95,7 @@ func (s *IntegrationTestSuite) Test1QueryOrders() { val.Address, deploymentPath, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), fmt.Sprintf("--deposit=%s", dcli.DefaultDeposit), @@ -110,10 +112,10 @@ func (s *IntegrationTestSuite) Test1QueryOrders() { err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), out) s.Require().NoError(err) s.Require().Len(out.Deployments, 1) - s.Require().Equal(val.Address.String(), out.Deployments[0].Deployment.DeploymentID.Owner) + s.Require().Equal(val.Address.String(), out.Deployments[0].Deployment.ID.Owner) // test query orders - resp, err = cli.QueryOrdersExec(val.ClientCtx.WithOutputFormat("json")) + resp, err = mcli.QueryOrdersExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) result := &types.QueryOrdersResponse{} @@ -121,11 +123,11 @@ func (s *IntegrationTestSuite) Test1QueryOrders() { s.Require().NoError(err) s.Require().Len(result.Orders, 1) orders := result.Orders - s.Require().Equal(val.Address.String(), orders[0].OrderID.Owner) + s.Require().Equal(val.Address.String(), orders[0].ID.Owner) // test query order createdOrder := orders[0] - resp, err = cli.QueryOrderExec(val.ClientCtx.WithOutputFormat("json"), createdOrder.OrderID) + resp, err = mcli.QueryOrderExec(val.ClientCtx.WithOutputFormat("json"), createdOrder.ID) s.Require().NoError(err) var order types.Order @@ -134,7 +136,7 @@ func (s *IntegrationTestSuite) Test1QueryOrders() { s.Require().Equal(createdOrder, order) // test query orders with filters - resp, err = cli.QueryOrdersExec( + resp, err = mcli.QueryOrdersExec( val.ClientCtx.WithOutputFormat("json"), fmt.Sprintf("--owner=%s", val.Address.String()), "--state=open", @@ -148,14 +150,14 @@ func (s *IntegrationTestSuite) Test1QueryOrders() { s.Require().Equal(createdOrder, result.Orders[0]) // test query orders with wrong owner value - _, err = cli.QueryOrdersExec( + _, err = mcli.QueryOrdersExec( val.ClientCtx.WithOutputFormat("json"), "--owner=cosmos102ruvpv2srmunfffxavttxnhezln6fnc3pf7tt", ) s.Require().Error(err) // test query orders with wrong state value - _, err = cli.QueryOrdersExec( + _, err = mcli.QueryOrdersExec( val.ClientCtx.WithOutputFormat("json"), "--state=hello", ) @@ -172,15 +174,18 @@ func (s *IntegrationTestSuite) Test2CreateBid() { keyBar, err := val.ClientCtx.Keyring.Key("keyBar") s.Require().NoError(err) + keyAddr, err := keyBar.GetAddress() + s.Require().NoError(err) + // Send coins from validator to keyBar - sendTokens := sdk.NewCoin(s.cfg.BondDenom, cli.DefaultDeposit.Amount.MulRaw(2)) - _, err = bankcli.MsgSendExec( + sendTokens := sdk.NewCoin(s.cfg.BondDenom, dcli.DefaultDeposit.Amount.MulRaw(2)) + _, err = sdktestutil.MsgSendExec( val.ClientCtx, val.Address, - keyBar.GetAddress(), + keyAddr, sdk.NewCoins(sendTokens), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -188,7 +193,7 @@ func (s *IntegrationTestSuite) Test2CreateBid() { s.Require().NoError(s.network.WaitForNextBlock()) - resp, err := bankcli.QueryBalancesExec(val.ClientCtx.WithOutputFormat("json"), keyBar.GetAddress()) + resp, err := sdktestutil.QueryBalancesExec(val.ClientCtx.WithOutputFormat("json"), keyAddr) s.Require().NoError(err) var balRes banktypes.QueryAllBalancesResponse @@ -199,10 +204,10 @@ func (s *IntegrationTestSuite) Test2CreateBid() { // create provider _, err = pcli.TxCreateProviderExec( val.ClientCtx, - keyBar.GetAddress(), + keyBar, providerPath, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -218,10 +223,10 @@ func (s *IntegrationTestSuite) Test2CreateBid() { err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), out) s.Require().NoError(err) s.Require().Len(out.Providers, 1, "Provider Creation Failed in TestCreateBid") - s.Require().Equal(keyBar.GetAddress().String(), out.Providers[0].Owner) + s.Require().Equal(keyBar.String(), out.Providers[0].Owner) // fetch orders - resp, err = cli.QueryOrdersExec(val.ClientCtx.WithOutputFormat("json")) + resp, err = mcli.QueryOrdersExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) result := &types.QueryOrdersResponse{} @@ -232,23 +237,23 @@ func (s *IntegrationTestSuite) Test2CreateBid() { createdOrder := result.Orders[0] // create bid - _, err = cli.TxCreateBidExec( + _, err = mcli.TxCreateBidExec( val.ClientCtx, - createdOrder.OrderID, + createdOrder.ID, sdk.NewDecCoinFromDec(testutil.CoinDenom, sdk.MustNewDecFromStr("1.1")), - keyBar.GetAddress(), + keyBar, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--deposit=%s", cli.DefaultDeposit), + fmt.Sprintf("--deposit=%s", dcli.DefaultDeposit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // test query bids - resp, err = cli.QueryBidsExec(val.ClientCtx.WithOutputFormat("json")) + resp, err = mcli.QueryBidsExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) bidRes := &types.QueryBidsResponse{} @@ -256,11 +261,11 @@ func (s *IntegrationTestSuite) Test2CreateBid() { s.Require().NoError(err) s.Require().Len(bidRes.Bids, 1) bids := bidRes.Bids - s.Require().Equal(keyBar.GetAddress().String(), bids[0].Bid.BidID.Provider) + s.Require().Equal(keyBar.String(), bids[0].Bid.ID.Provider) // test query bid createdBid := bids[0].Bid - resp, err = cli.QueryBidExec(val.ClientCtx.WithOutputFormat("json"), createdBid.BidID) + resp, err = mcli.QueryBidExec(val.ClientCtx.WithOutputFormat("json"), createdBid.ID) s.Require().NoError(err) var bid types.QueryBidResponse @@ -270,9 +275,9 @@ func (s *IntegrationTestSuite) Test2CreateBid() { s.Require().Equal(createdBid, bid.Bid) // test query bids with filters - resp, err = cli.QueryBidsExec( + resp, err = mcli.QueryBidsExec( val.ClientCtx.WithOutputFormat("json"), - fmt.Sprintf("--provider=%s", keyBar.GetAddress().String()), + fmt.Sprintf("--provider=%s", keyBar.String()), fmt.Sprintf("--state=%s", bid.Bid.State.String()), ) s.Require().NoError(err) @@ -284,26 +289,26 @@ func (s *IntegrationTestSuite) Test2CreateBid() { s.Require().Equal(createdBid, bidRes.Bids[0].Bid) // test query bids with wrong owner value - _, err = cli.QueryBidsExec( + _, err = mcli.QueryBidsExec( val.ClientCtx.WithOutputFormat("json"), "--owner=cosmos102ruvpv2srmunfffxavttxnhezln6fnc3pf7tt", ) s.Require().Error(err) // test query bids with wrong state value - _, err = cli.QueryBidsExec( + _, err = mcli.QueryBidsExec( val.ClientCtx.WithOutputFormat("json"), "--state=hello", ) s.Require().Error(err) // create lease - _, err = cli.TxCreateLeaseExec( + _, err = mcli.TxCreateLeaseExec( val.ClientCtx, - bid.Bid.BidID, + bid.Bid.ID, val.Address, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -320,7 +325,7 @@ func (s *IntegrationTestSuite) Test3QueryLeasesAndCloseBid() { s.Require().NoError(err) // test query leases - resp, err := cli.QueryLeasesExec(val.ClientCtx.WithOutputFormat("json")) + resp, err := mcli.QueryLeasesExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) leaseRes := &types.QueryLeasesResponse{} @@ -328,11 +333,11 @@ func (s *IntegrationTestSuite) Test3QueryLeasesAndCloseBid() { s.Require().NoError(err) s.Require().Len(leaseRes.Leases, 1) leases := leaseRes.Leases - s.Require().Equal(keyBar.GetAddress().String(), leases[0].Lease.LeaseID.Provider) + s.Require().Equal(keyBar.String(), leases[0].Lease.ID.Provider) // test query lease createdLease := leases[0].Lease - resp, err = cli.QueryLeaseExec(val.ClientCtx.WithOutputFormat("json"), createdLease.LeaseID) + resp, err = mcli.QueryLeaseExec(val.ClientCtx.WithOutputFormat("json"), createdLease.ID) s.Require().NoError(err) var lease types.QueryLeaseResponse @@ -341,12 +346,12 @@ func (s *IntegrationTestSuite) Test3QueryLeasesAndCloseBid() { s.Require().Equal(createdLease, lease.Lease) // create bid - _, err = cli.TxCloseBidExec( + _, err = mcli.TxCloseBidExec( val.ClientCtx, - lease.Lease.LeaseID.OrderID(), - keyBar.GetAddress(), + lease.Lease.ID.OrderID(), + keyBar, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), "--gas=auto", "--gas-adjustment=1.5", @@ -355,17 +360,17 @@ func (s *IntegrationTestSuite) Test3QueryLeasesAndCloseBid() { s.Require().NoError(s.network.WaitForNextBlock()) // test query closed bids - resp, err = cli.QueryBidsExec(val.ClientCtx.WithOutputFormat("json"), "--state=closed") + resp, err = mcli.QueryBidsExec(val.ClientCtx.WithOutputFormat("json"), "--state=closed") s.Require().NoError(err) bidRes := &types.QueryBidsResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), bidRes) s.Require().NoError(err) s.Require().Len(bidRes.Bids, 1) - s.Require().Equal(keyBar.GetAddress().String(), bidRes.Bids[0].Bid.BidID.Provider) + s.Require().Equal(keyBar.String(), bidRes.Bids[0].Bid.ID.Provider) // test query leases with state value filter - resp, err = cli.QueryLeasesExec(val.ClientCtx.WithOutputFormat("json"), "--state=closed") + resp, err = mcli.QueryLeasesExec(val.ClientCtx.WithOutputFormat("json"), "--state=closed") s.Require().NoError(err) leaseRes = &types.QueryLeasesResponse{} @@ -374,14 +379,14 @@ func (s *IntegrationTestSuite) Test3QueryLeasesAndCloseBid() { s.Require().Len(leaseRes.Leases, 1) // test query leases with wrong owner value - _, err = cli.QueryLeasesExec( + _, err = mcli.QueryLeasesExec( val.ClientCtx.WithOutputFormat("json"), "--provider=cosmos102ruvpv2srmunfffxavttxnhezln6fnc3pf7tt", ) s.Require().Error(err) // test query leases with wrong state value - _, err = cli.QueryLeasesExec( + _, err = mcli.QueryLeasesExec( val.ClientCtx.WithOutputFormat("json"), "--state=hello", ) @@ -393,7 +398,7 @@ func (s *IntegrationTestSuite) Test4CloseOrder() { val := s.network.Validators[0] // fetch open orders - resp, err := cli.QueryOrdersExec( + resp, err := mcli.QueryOrdersExec( val.ClientCtx.WithOutputFormat("json"), "--state=open", ) diff --git a/x/market/client/cli/flags.go b/x/market/client/cli/flags.go deleted file mode 100644 index 1e4e8489dd..0000000000 --- a/x/market/client/cli/flags.go +++ /dev/null @@ -1,210 +0,0 @@ -package cli - -import ( - "errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - - dcli "github.com/akash-network/node/x/deployment/client/cli" -) - -var ( - ErrStateValue = errors.New("query: invalid state value") - DefaultDeposit = types.DefaultBidMinDeposit -) - -// AddOrderIDFlags add flags for order -func AddOrderIDFlags(flags *pflag.FlagSet, opts ...dcli.DeploymentIDOption) { - dcli.AddGroupIDFlags(flags, opts...) - flags.Uint32("oseq", 1, "Order Sequence") -} - -// MarkReqOrderIDFlags marks flags required for order -func MarkReqOrderIDFlags(cmd *cobra.Command, opts ...dcli.DeploymentIDOption) { - dcli.MarkReqGroupIDFlags(cmd, opts...) -} - -// AddProviderFlag add provider flag to command flags set -func AddProviderFlag(flags *pflag.FlagSet) { - flags.String("provider", "", "Provider") -} - -// MarkReqProviderFlag marks provider flag as required -func MarkReqProviderFlag(cmd *cobra.Command) { - _ = cmd.MarkFlagRequired("provider") -} - -// OrderIDFromFlags returns OrderID with given flags and error if occurred -func OrderIDFromFlags(flags *pflag.FlagSet, opts ...dcli.MarketOption) (types.OrderID, error) { - prev, err := dcli.GroupIDFromFlags(flags, opts...) - if err != nil { - return types.OrderID{}, err - } - val, err := flags.GetUint32("oseq") - if err != nil { - return types.OrderID{}, err - } - return types.MakeOrderID(prev, val), nil -} - -// AddBidIDFlags add flags for bid -func AddBidIDFlags(flags *pflag.FlagSet, opts ...dcli.DeploymentIDOption) { - AddOrderIDFlags(flags, opts...) - AddProviderFlag(flags) -} - -// AddQueryBidIDFlags add flags for bid in query commands -func AddQueryBidIDFlags(flags *pflag.FlagSet) { - AddBidIDFlags(flags) -} - -// MarkReqBidIDFlags marks flags required for bid -// Used in get bid query command -func MarkReqBidIDFlags(cmd *cobra.Command, opts ...dcli.DeploymentIDOption) { - MarkReqOrderIDFlags(cmd, opts...) - MarkReqProviderFlag(cmd) -} - -// BidIDFromFlags returns BidID with given flags and error if occurred -// Here provider value is taken from flags -func BidIDFromFlags(flags *pflag.FlagSet, opts ...dcli.MarketOption) (types.BidID, error) { - prev, err := OrderIDFromFlags(flags, opts...) - if err != nil { - return types.BidID{}, err - } - - opt := &dcli.MarketOptions{} - - for _, o := range opts { - o(opt) - } - - if opt.Provider.Empty() { - provider, err := flags.GetString("provider") - if err != nil { - return types.BidID{}, err - } - - if opt.Provider, err = sdk.AccAddressFromBech32(provider); err != nil { - return types.BidID{}, err - } - } - - return types.MakeBidID(prev, opt.Provider), nil -} - -func AddLeaseIDFlags(flags *pflag.FlagSet, opts ...dcli.DeploymentIDOption) { - AddBidIDFlags(flags, opts...) -} - -// MarkReqLeaseIDFlags marks flags required for bid -// Used in get bid query command -func MarkReqLeaseIDFlags(cmd *cobra.Command, opts ...dcli.DeploymentIDOption) { - MarkReqBidIDFlags(cmd, opts...) -} - -// LeaseIDFromFlags returns LeaseID with given flags and error if occurred -// Here provider value is taken from flags -func LeaseIDFromFlags(flags *pflag.FlagSet, opts ...dcli.MarketOption) (types.LeaseID, error) { - bid, err := BidIDFromFlags(flags, opts...) - if err != nil { - return types.LeaseID{}, err - } - - return bid.LeaseID(), nil -} - -// AddOrderFilterFlags add flags to filter for order list -func AddOrderFilterFlags(flags *pflag.FlagSet) { - flags.String("owner", "", "order owner address to filter") - flags.String("state", "", "order state to filter (open,matched,closed)") - flags.Uint64("dseq", 0, "deployment sequence to filter") - flags.Uint32("gseq", 1, "group sequence to filter") - flags.Uint32("oseq", 1, "order sequence to filter") -} - -// OrderFiltersFromFlags returns OrderFilters with given flags and error if occurred -func OrderFiltersFromFlags(flags *pflag.FlagSet) (types.OrderFilters, error) { - dfilters, err := dcli.DepFiltersFromFlags(flags) - if err != nil { - return types.OrderFilters{}, err - } - ofilters := types.OrderFilters{ - Owner: dfilters.Owner, - DSeq: dfilters.DSeq, - State: dfilters.State, - } - - if ofilters.GSeq, err = flags.GetUint32("gseq"); err != nil { - return ofilters, err - } - - if ofilters.OSeq, err = flags.GetUint32("oseq"); err != nil { - return ofilters, err - } - - return ofilters, nil -} - -// AddBidFilterFlags add flags to filter for bid list -func AddBidFilterFlags(flags *pflag.FlagSet) { - flags.String("owner", "", "bid owner address to filter") - flags.String("state", "", "bid state to filter (open,matched,lost,closed)") - flags.Uint64("dseq", 0, "deployment sequence to filter") - flags.Uint32("gseq", 1, "group sequence to filter") - flags.Uint32("oseq", 1, "order sequence to filter") - flags.String("provider", "", "bid provider address to filter") -} - -// BidFiltersFromFlags returns BidFilters with given flags and error if occurred -func BidFiltersFromFlags(flags *pflag.FlagSet) (types.BidFilters, error) { - ofilters, err := OrderFiltersFromFlags(flags) - if err != nil { - return types.BidFilters{}, err - } - bfilters := types.BidFilters{ - Owner: ofilters.Owner, - DSeq: ofilters.DSeq, - GSeq: ofilters.OSeq, - OSeq: ofilters.OSeq, - State: ofilters.State, - } - - provider, err := flags.GetString("provider") - if err != nil { - return bfilters, err - } - - if provider != "" { - _, err = sdk.AccAddressFromBech32(provider) - if err != nil { - return bfilters, err - } - } - bfilters.Provider = provider - - return bfilters, nil -} - -// AddLeaseFilterFlags add flags to filter for lease list -func AddLeaseFilterFlags(flags *pflag.FlagSet) { - flags.String("owner", "", "lease owner address to filter") - flags.String("state", "", "lease state to filter (active,insufficient_funds,closed)") - flags.Uint64("dseq", 0, "deployment sequence to filter") - flags.Uint32("gseq", 1, "group sequence to filter") - flags.Uint32("oseq", 1, "order sequence to filter") - flags.String("provider", "", "bid provider address to filter") -} - -// LeaseFiltersFromFlags returns LeaseFilters with given flags and error if occurred -func LeaseFiltersFromFlags(flags *pflag.FlagSet) (types.LeaseFilters, error) { - bfilters, err := BidFiltersFromFlags(flags) - if err != nil { - return types.LeaseFilters{}, err - } - return types.LeaseFilters(bfilters), nil -} diff --git a/x/market/client/cli/grpc_rest_test.go b/x/market/client/cli/grpc_rest_test.go index 1f412cfe7d..5211fd6edb 100644 --- a/x/market/client/cli/grpc_rest_test.go +++ b/x/market/client/cli/grpc_rest_test.go @@ -6,23 +6,25 @@ import ( "path/filepath" "testing" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil" + sdktestutilcli "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - sdkrest "github.com/cosmos/cosmos-sdk/types/rest" - bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/testutil" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + "pkg.akt.dev/go/cli" + "pkg.akt.dev/go/node/market/v1" + "pkg.akt.dev/go/node/market/v1beta5" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/network" - ccli "github.com/akash-network/node/x/cert/client/cli" - dcli "github.com/akash-network/node/x/deployment/client/cli" - "github.com/akash-network/node/x/market/client/cli" - pcli "github.com/akash-network/node/x/provider/client/cli" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/network" + ccli "pkg.akt.dev/akashd/x/cert/client/cli" + dcli "pkg.akt.dev/akashd/x/deployment/client/cli" + mcli "pkg.akt.dev/akashd/x/market/client/cli" + pcli "pkg.akt.dev/akashd/x/provider/client/cli" ) type GRPCRestTestSuite struct { @@ -30,9 +32,9 @@ type GRPCRestTestSuite struct { cfg network.Config network *network.Network - order types.Order - bid types.Bid - lease types.Lease + order v1beta5.Order + bid v1beta5.Bid + lease v1.Lease } func (s *GRPCRestTestSuite) SetupSuite() { @@ -45,8 +47,10 @@ func (s *GRPCRestTestSuite) SetupSuite() { s.network = network.New(s.T(), cfg) kb := s.network.Validators[0].ClientCtx.Keyring - keyBar, _, err := kb.NewMnemonic("keyBar", keyring.English, sdk.FullFundraiserPath, "", - hd.Secp256k1) + keyBar, _, err := kb.NewMnemonic("keyBar", keyring.English, sdk.FullFundraiserPath, "", hd.Secp256k1) + s.Require().NoError(err) + + keyAddr, err := keyBar.GetAddress() s.Require().NoError(err) _, err = s.network.WaitForHeight(1) @@ -68,7 +72,7 @@ func (s *GRPCRestTestSuite) SetupSuite() { val.ClientCtx, val.Address, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -87,7 +91,7 @@ func (s *GRPCRestTestSuite) SetupSuite() { val.Address, deploymentPath, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), fmt.Sprintf("--deposit=%s", dcli.DefaultDeposit), @@ -97,28 +101,28 @@ func (s *GRPCRestTestSuite) SetupSuite() { s.Require().NoError(s.network.WaitForNextBlock()) // test query orders - resp, err := cli.QueryOrdersExec(val.ClientCtx.WithOutputFormat("json")) + resp, err := mcli.QueryOrdersExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) - result := &types.QueryOrdersResponse{} + result := &v1beta5.QueryOrdersResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), result) s.Require().NoError(err) s.Require().Len(result.Orders, 1) orders := result.Orders - s.Require().Equal(val.Address.String(), orders[0].OrderID.Owner) + s.Require().Equal(val.Address.String(), orders[0].ID.Owner) // test query order s.order = orders[0] // Send coins from validator to keyBar - sendTokens := cli.DefaultDeposit.Add(cli.DefaultDeposit) - _, err = bankcli.MsgSendExec( + sendTokens := dcli.DefaultDeposit.Add(dcli.DefaultDeposit) + _, err = sdktestutilcli.MsgSendExec( val.ClientCtx, val.Address, - keyBar.GetAddress(), + keyAddr, sdk.NewCoins(sendTokens), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -129,10 +133,10 @@ func (s *GRPCRestTestSuite) SetupSuite() { // create provider _, err = pcli.TxCreateProviderExec( val.ClientCtx, - keyBar.GetAddress(), + keyAddr, providerPath, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -140,41 +144,41 @@ func (s *GRPCRestTestSuite) SetupSuite() { s.Require().NoError(s.network.WaitForNextBlock()) - _, err = cli.TxCreateBidExec( + _, err = mcli.TxCreateBidExec( val.ClientCtx, - s.order.OrderID, + s.order.ID, sdk.NewDecCoinFromDec(testutil.CoinDenom, sdk.MustNewDecFromStr("1.1")), - keyBar.GetAddress(), + keyAddr, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--deposit=%s", cli.DefaultDeposit), + fmt.Sprintf("--deposit=%s", dcli.DefaultDeposit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // get bid - resp, err = cli.QueryBidsExec(val.ClientCtx.WithOutputFormat("json")) + resp, err = mcli.QueryBidsExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) - bidRes := &types.QueryBidsResponse{} + bidRes := &v1beta5.QueryBidsResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), bidRes) s.Require().NoError(err) s.Require().Len(bidRes.Bids, 1) bids := bidRes.Bids - s.Require().Equal(keyBar.GetAddress().String(), bids[0].Bid.BidID.Provider) + s.Require().Equal(keyAddr.String(), bids[0].Bid.ID.Provider) s.bid = bids[0].Bid // create lease - _, err = cli.TxCreateLeaseExec( + _, err = mcli.TxCreateLeaseExec( val.ClientCtx, - s.bid.BidID, + s.bid.ID, val.Address, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -183,18 +187,18 @@ func (s *GRPCRestTestSuite) SetupSuite() { s.Require().NoError(s.network.WaitForNextBlock()) // test query leases - resp, err = cli.QueryLeasesExec(val.ClientCtx.WithOutputFormat("json")) + resp, err = mcli.QueryLeasesExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) - leaseRes := &types.QueryLeasesResponse{} + leaseRes := &v1beta5.QueryLeasesResponse{} err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), leaseRes) s.Require().NoError(err) s.Require().Len(leaseRes.Leases, 1) leases := leaseRes.Leases - s.Require().Equal(keyBar.GetAddress().String(), leases[0].Lease.LeaseID.Provider) + s.Require().Equal(keyAddr.String(), leases[0].Lease.ID.Provider) - s.order.State = types.OrderActive - s.bid.State = types.BidActive + s.order.State = v1.OrderActive + s.bid.State = v1.BidActive // test query lease s.lease = leases[0].Lease @@ -208,12 +212,12 @@ func (s *GRPCRestTestSuite) TestGetOrders() { name string url string expErr bool - expResp types.Order + expResp v1beta5.Order expLen int }{ { "get orders without filters", - fmt.Sprintf("%s/akash/market/%s/orders/list", val.APIAddress, types.APIVersion), + fmt.Sprintf("%s/akash/market/%s/orders/list", val.APIAddress, v1beta5.GatewayVersion), false, order, 1, @@ -221,8 +225,8 @@ func (s *GRPCRestTestSuite) TestGetOrders() { { "get orders with filters", fmt.Sprintf("%s/akash/market/%s/orders/list?filters.owner=%s", val.APIAddress, - types.APIVersion, - order.OrderID.Owner), + v1beta5.GatewayVersion, + order.ID.Owner), false, order, 1, @@ -230,16 +234,16 @@ func (s *GRPCRestTestSuite) TestGetOrders() { { "get orders with wrong state filter", fmt.Sprintf("%s/akash/market/%s/orders/list?filters.state=%s", val.APIAddress, - types.APIVersion, - types.OrderStateInvalid.String()), + v1beta5.GatewayVersion, + v1.OrderStateInvalid.String()), true, - types.Order{}, + v1beta5.Order{}, 0, }, { "get orders with two filters", fmt.Sprintf("%s/akash/market/%s/orders/list?filters.state=%s&filters.oseq=%d", - val.APIAddress, types.APIVersion, order.State.String(), order.OrderID.OSeq), + val.APIAddress, v1beta5.GatewayVersion, order.State.String(), order.ID.OSeq), false, order, 1, @@ -249,10 +253,10 @@ func (s *GRPCRestTestSuite) TestGetOrders() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var orders types.QueryOrdersResponse + var orders v1beta5.QueryOrdersResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &orders) if tc.expErr { @@ -275,40 +279,40 @@ func (s *GRPCRestTestSuite) TestGetOrder() { name string url string expErr bool - expResp types.Order + expResp v1beta5.Order }{ { "get order with empty input", - fmt.Sprintf("%s/akash/market/%s/orders/info", val.APIAddress, types.APIVersion), + fmt.Sprintf("%s/akash/market/%s/orders/info", val.APIAddress, v1beta5.GatewayVersion), true, - types.Order{}, + v1beta5.Order{}, }, { "get order with invalid input", fmt.Sprintf("%s/akash/market/%s/orders/info?id.owner=%s", val.APIAddress, - types.APIVersion, - order.OrderID.Owner), + v1beta5.GatewayVersion, + order.ID.Owner), true, - types.Order{}, + v1beta5.Order{}, }, { "order not found", fmt.Sprintf("%s/akash/market/%s/orders/info?id.owner=%s&id.dseq=%d&id.gseq=%d&id.oseq=%d", val.APIAddress, - types.APIVersion, - order.OrderID.Owner, 249, 32, 235), + v1beta5.GatewayVersion, + order.ID.Owner, 249, 32, 235), true, - types.Order{}, + v1beta5.Order{}, }, { "valid get order request", fmt.Sprintf("%s/akash/market/%s/orders/info?id.owner=%s&id.dseq=%d&id.gseq=%d&id.oseq=%d", val.APIAddress, - types.APIVersion, - order.OrderID.Owner, - order.OrderID.DSeq, - order.OrderID.GSeq, - order.OrderID.OSeq), + v1beta5.GatewayVersion, + order.ID.Owner, + order.ID.DSeq, + order.ID.GSeq, + order.ID.OSeq), false, order, }, @@ -317,10 +321,10 @@ func (s *GRPCRestTestSuite) TestGetOrder() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var out types.QueryOrderResponse + var out v1beta5.QueryOrderResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &out) if tc.expErr { @@ -341,12 +345,12 @@ func (s *GRPCRestTestSuite) TestGetBids() { name string url string expErr bool - expResp types.Bid + expResp v1beta5.Bid expLen int }{ { "get bids without filters", - fmt.Sprintf("%s/akash/market/%s/bids/list", val.APIAddress, types.APIVersion), + fmt.Sprintf("%s/akash/market/%s/bids/list", val.APIAddress, v1beta5.GatewayVersion), false, bid, 1, @@ -355,8 +359,8 @@ func (s *GRPCRestTestSuite) TestGetBids() { "get bids with filters", fmt.Sprintf("%s/akash/market/%s/bids/list?filters.owner=%s", val.APIAddress, - types.APIVersion, - bid.BidID.Owner), + v1beta5.GatewayVersion, + bid.ID.Owner), false, bid, 1, @@ -365,20 +369,20 @@ func (s *GRPCRestTestSuite) TestGetBids() { "get bids with wrong state filter", fmt.Sprintf("%s/akash/market/%s/bids/list?filters.state=%s", val.APIAddress, - types.APIVersion, - types.BidStateInvalid.String()), + v1beta5.GatewayVersion, + v1.BidStateInvalid.String()), true, - types.Bid{}, + v1beta5.Bid{}, 0, }, { "get bids with more filters", fmt.Sprintf("%s/akash/market/%s/bids/list?filters.state=%s&filters.oseq=%d&filters.provider=%s", val.APIAddress, - types.APIVersion, + v1beta5.GatewayVersion, bid.State.String(), - bid.BidID.OSeq, - bid.BidID.Provider), + bid.ID.OSeq, + bid.ID.Provider), false, bid, 1, @@ -388,10 +392,10 @@ func (s *GRPCRestTestSuite) TestGetBids() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var bids types.QueryBidsResponse + var bids v1beta5.QueryBidsResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &bids) if tc.expErr { @@ -414,46 +418,46 @@ func (s *GRPCRestTestSuite) TestGetBid() { name string url string expErr bool - expResp types.Bid + expResp v1beta5.Bid }{ { "get bid with empty input", - fmt.Sprintf("%s/akash/market/%s/bids/info", val.APIAddress, types.APIVersion), + fmt.Sprintf("%s/akash/market/%s/bids/info", val.APIAddress, v1beta5.GatewayVersion), true, - types.Bid{}, + v1beta5.Bid{}, }, { "get bid with invalid input", fmt.Sprintf("%s/akash/market/%s/bids/info?id.owner=%s", val.APIAddress, - types.APIVersion, - bid.BidID.Owner), + v1beta5.GatewayVersion, + bid.ID.Owner), true, - types.Bid{}, + v1beta5.Bid{}, }, { "bid not found", fmt.Sprintf("%s/akash/market/%s/bids/info?id.owner=%s&id.dseq=%d&id.gseq=%d&id.oseq=%d&id.provider=%s", val.APIAddress, - types.APIVersion, - bid.BidID.Provider, + v1beta5.GatewayVersion, + bid.ID.Provider, 249, 32, 235, - bid.BidID.Owner), + bid.ID.Owner), true, - types.Bid{}, + v1beta5.Bid{}, }, { "valid get bid request", fmt.Sprintf("%s/akash/market/%s/bids/info?id.owner=%s&id.dseq=%d&id.gseq=%d&id.oseq=%d&id.provider=%s", val.APIAddress, - types.APIVersion, - bid.BidID.Owner, - bid.BidID.DSeq, - bid.BidID.GSeq, - bid.BidID.OSeq, - bid.BidID.Provider), + v1beta5.GatewayVersion, + bid.ID.Owner, + bid.ID.DSeq, + bid.ID.GSeq, + bid.ID.OSeq, + bid.ID.Provider), false, bid, }, @@ -462,10 +466,10 @@ func (s *GRPCRestTestSuite) TestGetBid() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var out types.QueryBidResponse + var out v1beta5.QueryBidResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &out) if tc.expErr { @@ -486,12 +490,12 @@ func (s *GRPCRestTestSuite) TestGetLeases() { name string url string expErr bool - expResp types.Lease + expResp v1.Lease expLen int }{ { "get leases without filters", - fmt.Sprintf("%s/akash/market/%s/leases/list", val.APIAddress, types.APIVersion), + fmt.Sprintf("%s/akash/market/%s/leases/list", val.APIAddress, v1beta5.GatewayVersion), false, lease, 1, @@ -500,8 +504,8 @@ func (s *GRPCRestTestSuite) TestGetLeases() { "get leases with filters", fmt.Sprintf("%s/akash/market/%s/leases/list?filters.owner=%s", val.APIAddress, - types.APIVersion, - lease.LeaseID.Owner), + v1beta5.GatewayVersion, + lease.ID.Owner), false, lease, 1, @@ -510,20 +514,20 @@ func (s *GRPCRestTestSuite) TestGetLeases() { "get leases with wrong state filter", fmt.Sprintf("%s/akash/market/%s/leases/list?filters.state=%s", val.APIAddress, - types.APIVersion, - types.LeaseStateInvalid.String()), + v1beta5.GatewayVersion, + v1.LeaseStateInvalid.String()), true, - types.Lease{}, + v1.Lease{}, 0, }, { "get leases with more filters", fmt.Sprintf("%s/akash/market/%s/leases/list?filters.state=%s&filters.oseq=%d&filters.provider=%s", val.APIAddress, - types.APIVersion, + v1beta5.GatewayVersion, lease.State.String(), - lease.LeaseID.OSeq, - lease.LeaseID.Provider), + lease.ID.OSeq, + lease.ID.Provider), false, lease, 1, @@ -533,10 +537,10 @@ func (s *GRPCRestTestSuite) TestGetLeases() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var leases types.QueryLeasesResponse + var leases v1beta5.QueryLeasesResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &leases) if tc.expErr { @@ -559,46 +563,46 @@ func (s *GRPCRestTestSuite) TestGetLease() { name string url string expErr bool - expResp types.Lease + expResp v1.Lease }{ { "get lease with empty input", - fmt.Sprintf("%s/akash/market/%s/leases/info", val.APIAddress, types.APIVersion), + fmt.Sprintf("%s/akash/market/%s/leases/info", val.APIAddress, v1beta5.GatewayVersion), true, - types.Lease{}, + v1.Lease{}, }, { "get lease with invalid input", fmt.Sprintf("%s/akash/market/%s/leases/info?id.owner=%s", val.APIAddress, - types.APIVersion, - lease.LeaseID.Owner), + v1beta5.GatewayVersion, + lease.ID.Owner), true, - types.Lease{}, + v1.Lease{}, }, { "lease not found", fmt.Sprintf("%s/akash/market/%s/leases/info?id.owner=%s&id.dseq=%d&id.gseq=%d&id.oseq=%d&id.provider=%s", val.APIAddress, - types.APIVersion, - lease.LeaseID.Provider, + v1beta5.GatewayVersion, + lease.ID.Provider, 249, 32, 235, - lease.LeaseID.Owner), + lease.ID.Owner), true, - types.Lease{}, + v1.Lease{}, }, { "valid get lease request", fmt.Sprintf("%s/akash/market/%s/leases/info?id.owner=%s&id.dseq=%d&id.gseq=%d&id.oseq=%d&id.provider=%s", val.APIAddress, - types.APIVersion, - lease.LeaseID.Owner, - lease.LeaseID.DSeq, - lease.LeaseID.GSeq, - lease.LeaseID.OSeq, - lease.LeaseID.Provider), + v1beta5.GatewayVersion, + lease.ID.Owner, + lease.ID.DSeq, + lease.ID.GSeq, + lease.ID.OSeq, + lease.ID.Provider), false, lease, }, @@ -607,10 +611,10 @@ func (s *GRPCRestTestSuite) TestGetLease() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) - var out types.QueryLeaseResponse + var out v1beta5.QueryLeaseResponse err = val.ClientCtx.Codec.UnmarshalJSON(resp, &out) if tc.expErr { diff --git a/x/market/client/cli/lease.go b/x/market/client/cli/lease.go index f8267dd14f..288248ef25 100644 --- a/x/market/client/cli/lease.go +++ b/x/market/client/cli/lease.go @@ -2,12 +2,12 @@ package cli import ( sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" + "pkg.akt.dev/go/cli" + v1 "pkg.akt.dev/go/node/market/v1" + "pkg.akt.dev/go/node/market/v1beta5" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - - aclient "github.com/akash-network/node/client" + aclient "pkg.akt.dev/akashd/client" ) func cmdGetLeases() *cobra.Command { @@ -27,7 +27,7 @@ func cmdGetLeases() *cobra.Command { return err } - lfilters, err := LeaseFiltersFromFlags(cmd.Flags()) + lfilters, err := cli.LeaseFiltersFromFlags(cmd.Flags()) if err != nil { return err } @@ -37,7 +37,7 @@ func cmdGetLeases() *cobra.Command { return err } - params := &types.QueryLeasesRequest{ + params := &v1beta5.QueryLeasesRequest{ Filters: lfilters, Pagination: pageReq, } @@ -51,9 +51,9 @@ func cmdGetLeases() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, "leases") - AddLeaseFilterFlags(cmd.Flags()) + cli.AddQueryFlagsToCmd(cmd) + cli.AddPaginationFlagsToCmd(cmd, "leases") + cli.AddLeaseFilterFlags(cmd.Flags()) return cmd } @@ -76,12 +76,12 @@ func cmdGetLease() *cobra.Command { return err } - bidID, err := BidIDFromFlags(cmd.Flags()) + bidID, err := cli.BidIDFromFlags(cmd.Flags()) if err != nil { return err } - res, err := qq.Lease(cmd.Context(), &types.QueryLeaseRequest{ID: types.MakeLeaseID(bidID)}) + res, err := qq.Lease(cmd.Context(), &v1beta5.QueryLeaseRequest{ID: v1.MakeLeaseID(bidID)}) if err != nil { return err } @@ -90,9 +90,9 @@ func cmdGetLease() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) - AddQueryBidIDFlags(cmd.Flags()) - MarkReqBidIDFlags(cmd) + cli.AddQueryFlagsToCmd(cmd) + cli.AddQueryBidIDFlags(cmd.Flags()) + cli.MarkReqBidIDFlags(cmd) return cmd } diff --git a/x/market/client/cli/order.go b/x/market/client/cli/order.go index 0fee536a27..a1035cf1f1 100644 --- a/x/market/client/cli/order.go +++ b/x/market/client/cli/order.go @@ -2,12 +2,11 @@ package cli import ( sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" + "pkg.akt.dev/go/cli" + "pkg.akt.dev/go/node/market/v1beta5" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - - aclient "github.com/akash-network/node/client" + aclient "pkg.akt.dev/akashd/client" ) func cmdGetOrders() *cobra.Command { @@ -27,7 +26,7 @@ func cmdGetOrders() *cobra.Command { return err } - ofilters, err := OrderFiltersFromFlags(cmd.Flags()) + ofilters, err := cli.OrderFiltersFromFlags(cmd.Flags()) if err != nil { return err } @@ -37,7 +36,7 @@ func cmdGetOrders() *cobra.Command { return err } - params := &types.QueryOrdersRequest{ + params := &v1beta5.QueryOrdersRequest{ Filters: ofilters, Pagination: pageReq, } @@ -51,9 +50,9 @@ func cmdGetOrders() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) - flags.AddPaginationFlagsToCmd(cmd, "orders") - AddOrderFilterFlags(cmd.Flags()) + cli.AddQueryFlagsToCmd(cmd) + cli.AddPaginationFlagsToCmd(cmd, "orders") + cli.AddOrderFilterFlags(cmd.Flags()) return cmd } @@ -75,12 +74,12 @@ func cmdGetOrder() *cobra.Command { return err } - id, err := OrderIDFromFlags(cmd.Flags()) + id, err := cli.OrderIDFromFlags(cmd.Flags()) if err != nil { return err } - res, err := qq.Order(cmd.Context(), &types.QueryOrderRequest{ID: id}) + res, err := qq.Order(cmd.Context(), &v1beta5.QueryOrderRequest{ID: id}) if err != nil { return err } @@ -89,9 +88,9 @@ func cmdGetOrder() *cobra.Command { }, } - flags.AddQueryFlagsToCmd(cmd) - AddOrderIDFlags(cmd.Flags()) - MarkReqOrderIDFlags(cmd) + cli.AddQueryFlagsToCmd(cmd) + cli.AddOrderIDFlags(cmd.Flags()) + cli.MarkReqOrderIDFlags(cmd) return cmd } diff --git a/x/market/client/cli/query.go b/x/market/client/cli/query.go index bd6f984fab..6197b5ef28 100644 --- a/x/market/client/cli/query.go +++ b/x/market/client/cli/query.go @@ -4,14 +4,14 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + "pkg.akt.dev/go/node/market/v1beta5" ) // GetQueryCmd returns the transaction commands for the market module func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ - Use: types.ModuleName, + Use: v1beta5.ModuleName, Short: "Market query commands", SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, diff --git a/x/market/client/cli/test_helpers.go b/x/market/client/cli/test_helpers.go index ac87c1615e..52ee120069 100644 --- a/x/market/client/cli/test_helpers.go +++ b/x/market/client/cli/test_helpers.go @@ -7,12 +7,13 @@ import ( sdktest "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1" + "pkg.akt.dev/go/node/market/v1beta5" ) // XXX: WHY TF DON'T THESE RETURN OBJECTS -const key string = types.StoreKey +const key string = v1beta5.StoreKey // TxCreateBidExec is used for testing create bid tx func TxCreateBidExec(clientCtx client.Context, orderID types.OrderID, price, from fmt.Stringer, diff --git a/x/market/client/cli/tx.go b/x/market/client/cli/tx.go index 97aa8b5707..811746512f 100644 --- a/x/market/client/cli/tx.go +++ b/x/market/client/cli/tx.go @@ -3,23 +3,22 @@ package cli import ( "fmt" - cltypes "github.com/akash-network/akash-api/go/node/client/types" sdkclient "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" + "pkg.akt.dev/go/cli" + "pkg.akt.dev/go/node/market/v1beta5" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + cltypes "pkg.akt.dev/go/node/client/types" - aclient "github.com/akash-network/node/client" - "github.com/akash-network/node/cmd/common" - dcli "github.com/akash-network/node/x/deployment/client/cli" + aclient "pkg.akt.dev/akashd/client" + "pkg.akt.dev/akashd/cmd/common" ) // GetTxCmd returns the transaction commands for market module func GetTxCmd(key string) *cobra.Command { cmd := &cobra.Command{ - Use: types.ModuleName, + Use: v1beta5.ModuleName, Short: "Transaction subcommands", SuggestionsMinimumDistance: 2, RunE: sdkclient.ValidateCmd, @@ -78,7 +77,7 @@ func cmdBidCreate(key string) *cobra.Command { return err } - id, err := OrderIDFromFlags(cmd.Flags(), dcli.WithProvider(cctx.FromAddress)) + id, err := cli.OrderIDFromFlags(cmd.Flags(), cli.WithProvider(cctx.FromAddress)) if err != nil { return err } @@ -88,8 +87,8 @@ func cmdBidCreate(key string) *cobra.Command { return err } - msg := &types.MsgCreateBid{ - Order: id, + msg := &v1beta5.MsgCreateBid{ + OrderID: id, Provider: cctx.GetFromAddress().String(), Price: coin, Deposit: deposit, @@ -108,8 +107,8 @@ func cmdBidCreate(key string) *cobra.Command { }, } - flags.AddTxFlagsToCmd(cmd) - AddOrderIDFlags(cmd.Flags()) + cli.AddTxFlagsToCmd(cmd) + cli.AddOrderIDFlags(cmd.Flags()) cmd.Flags().String("price", "", "Bid Price") common.AddDepositFlags(cmd.Flags()) @@ -139,13 +138,13 @@ func cmdBidClose(key string) *cobra.Command { return err } - id, err := BidIDFromFlags(cmd.Flags(), dcli.WithProvider(cctx.FromAddress)) + id, err := cli.BidIDFromFlags(cmd.Flags(), cli.WithProvider(cctx.FromAddress)) if err != nil { return err } - msg := &types.MsgCloseBid{ - BidID: id, + msg := &v1beta5.MsgCloseBid{ + ID: id, } if err := msg.ValidateBasic(); err != nil { @@ -161,8 +160,8 @@ func cmdBidClose(key string) *cobra.Command { }, } - flags.AddTxFlagsToCmd(cmd) - AddBidIDFlags(cmd.Flags()) + cli.AddTxFlagsToCmd(cmd) + cli.AddBidIDFlags(cmd.Flags()) return cmd } @@ -205,12 +204,12 @@ func cmdLeaseCreate(key string) *cobra.Command { return err } - id, err := LeaseIDFromFlags(cmd.Flags(), dcli.WithOwner(cctx.FromAddress)) + id, err := cli.LeaseIDFromFlags(cmd.Flags(), cli.WithOwner(cctx.FromAddress)) if err != nil { return err } - msg := &types.MsgCreateLease{ + msg := &v1beta5.MsgCreateLease{ BidID: id.BidID(), } @@ -227,9 +226,9 @@ func cmdLeaseCreate(key string) *cobra.Command { }, } - flags.AddTxFlagsToCmd(cmd) - AddLeaseIDFlags(cmd.Flags()) - MarkReqLeaseIDFlags(cmd, dcli.DeploymentIDOptionNoOwner(true)) + cli.AddTxFlagsToCmd(cmd) + cli.AddLeaseIDFlags(cmd.Flags()) + cli.MarkReqLeaseIDFlags(cmd, cli.DeploymentIDOptionNoOwner(true)) return cmd } @@ -257,13 +256,13 @@ func cmdLeaseWithdraw(key string) *cobra.Command { return err } - id, err := LeaseIDFromFlags(cmd.Flags(), dcli.WithOwner(cctx.FromAddress)) + id, err := cli.LeaseIDFromFlags(cmd.Flags(), cli.WithOwner(cctx.FromAddress)) if err != nil { return err } - msg := &types.MsgWithdrawLease{ - LeaseID: id, + msg := &v1beta5.MsgWithdrawLease{ + ID: id, } if err := msg.ValidateBasic(); err != nil { @@ -279,9 +278,9 @@ func cmdLeaseWithdraw(key string) *cobra.Command { }, } - flags.AddTxFlagsToCmd(cmd) - AddLeaseIDFlags(cmd.Flags()) - MarkReqLeaseIDFlags(cmd, dcli.DeploymentIDOptionNoOwner(true)) + cli.AddTxFlagsToCmd(cmd) + cli.AddLeaseIDFlags(cmd.Flags()) + cli.MarkReqLeaseIDFlags(cmd, cli.DeploymentIDOptionNoOwner(true)) return cmd } @@ -309,13 +308,13 @@ func cmdLeaseClose(key string) *cobra.Command { return err } - id, err := LeaseIDFromFlags(cmd.Flags(), dcli.WithOwner(cctx.FromAddress)) + id, err := cli.LeaseIDFromFlags(cmd.Flags(), cli.WithOwner(cctx.FromAddress)) if err != nil { return err } - msg := &types.MsgCloseLease{ - LeaseID: id, + msg := &v1beta5.MsgCloseLease{ + ID: id, } if err := msg.ValidateBasic(); err != nil { @@ -331,9 +330,9 @@ func cmdLeaseClose(key string) *cobra.Command { }, } - flags.AddTxFlagsToCmd(cmd) - AddLeaseIDFlags(cmd.Flags()) - MarkReqLeaseIDFlags(cmd, dcli.DeploymentIDOptionNoOwner(true)) + cli.AddTxFlagsToCmd(cmd) + cli.AddLeaseIDFlags(cmd.Flags()) + cli.MarkReqLeaseIDFlags(cmd, cli.DeploymentIDOptionNoOwner(true)) return cmd } diff --git a/x/market/client/rest/params.go b/x/market/client/rest/params.go index c737e10a82..0a39a78b1a 100644 --- a/x/market/client/rest/params.go +++ b/x/market/client/rest/params.go @@ -5,18 +5,17 @@ import ( "strconv" sdk "github.com/cosmos/cosmos-sdk/types" + "pkg.akt.dev/go/node/market/v1" + "pkg.akt.dev/go/node/market/v1beta5" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - - drest "github.com/akash-network/node/x/deployment/client/rest" - "github.com/akash-network/node/x/market/query" + drest "pkg.akt.dev/akashd/x/deployment/client/rest" ) // OrderIDFromRequest returns OrderID from parsing request -func OrderIDFromRequest(r *http.Request) (types.OrderID, string) { +func OrderIDFromRequest(r *http.Request) (v1.OrderID, string) { gID, errMsg := drest.GroupIDFromRequest(r) if len(errMsg) != 0 { - return types.OrderID{}, errMsg + return v1.OrderID{}, errMsg } oseqNo := r.URL.Query().Get("oseq") @@ -25,34 +24,34 @@ func OrderIDFromRequest(r *http.Request) (types.OrderID, string) { if len(oseqNo) != 0 { num, err := strconv.ParseUint(oseqNo, 10, 32) if err != nil { - return types.OrderID{}, err.Error() + return v1.OrderID{}, err.Error() } oseq = uint32(num) } else { - return types.OrderID{}, "Missing oseq query param" + return v1.OrderID{}, "Missing oseq query param" } - return types.MakeOrderID(gID, oseq), "" + return v1.MakeOrderID(gID, oseq), "" } // OrderFiltersFromRequest returns OrderFilters with given params in request -func OrderFiltersFromRequest(r *http.Request) (query.OrderFilters, string) { +func OrderFiltersFromRequest(r *http.Request) (v1beta5.OrderFilters, string) { gfilters, errMsg := drest.GroupFiltersFromRequest(r) if len(errMsg) != 0 { - return query.OrderFilters{}, errMsg + return v1beta5.OrderFilters{}, errMsg } - ofilters := query.OrderFilters{ - Owner: gfilters.Owner, - StateFlagVal: gfilters.StateFlagVal, + ofilters := v1beta5.OrderFilters{ + Owner: gfilters.Owner, + State: gfilters.State, } return ofilters, "" } // BidIDFromRequest returns BidID from parsing request -func BidIDFromRequest(r *http.Request) (types.BidID, string) { +func BidIDFromRequest(r *http.Request) (v1.BidID, string) { oID, errMsg := OrderIDFromRequest(r) if len(errMsg) != 0 { - return types.BidID{}, errMsg + return v1.BidID{}, errMsg } providerAddr := r.URL.Query().Get("provider") @@ -61,50 +60,50 @@ func BidIDFromRequest(r *http.Request) (types.BidID, string) { if len(providerAddr) != 0 { addr, err := sdk.AccAddressFromBech32(providerAddr) if err != nil { - return types.BidID{}, err.Error() + return v1.BidID{}, err.Error() } provider = addr } else { - return types.BidID{}, "Missing provider query param" + return v1.BidID{}, "Missing provider query param" } - return types.MakeBidID(oID, provider), "" + return v1.MakeBidID(oID, provider), "" } // BidFiltersFromRequest returns BidFilters with given params in request -func BidFiltersFromRequest(r *http.Request) (query.BidFilters, string) { +func BidFiltersFromRequest(r *http.Request) (v1beta5.BidFilters, string) { ofilters, errMsg := drest.GroupFiltersFromRequest(r) if len(errMsg) != 0 { - return query.BidFilters{}, errMsg + return v1beta5.BidFilters{}, errMsg } - bfilters := query.BidFilters{ - Owner: ofilters.Owner, - StateFlagVal: ofilters.StateFlagVal, + bfilters := v1beta5.BidFilters{ + Owner: ofilters.Owner, + State: ofilters.State, } return bfilters, "" } // LeaseIDFromRequest returns LeaseID from parsing request -func LeaseIDFromRequest(r *http.Request) (types.LeaseID, string) { +func LeaseIDFromRequest(r *http.Request) (v1.LeaseID, string) { bID, errMsg := BidIDFromRequest(r) if len(errMsg) != 0 { - return types.LeaseID{}, errMsg + return v1.LeaseID{}, errMsg } - return types.MakeLeaseID(bID), "" + return v1.MakeLeaseID(bID), "" } // LeaseFiltersFromRequest returns LeaseFilters with given params in request -func LeaseFiltersFromRequest(r *http.Request) (query.LeaseFilters, string) { +func LeaseFiltersFromRequest(r *http.Request) (v1.LeaseFilters, string) { bfilters, errMsg := drest.GroupFiltersFromRequest(r) if len(errMsg) != 0 { - return query.LeaseFilters{}, errMsg + return v1.LeaseFilters{}, errMsg } - lfilters := query.LeaseFilters{ - Owner: bfilters.Owner, - StateFlagVal: bfilters.StateFlagVal, + lfilters := v1.LeaseFilters{ + Owner: bfilters.Owner, + State: bfilters.State, } return lfilters, "" } diff --git a/x/market/client/rest/rest.go b/x/market/client/rest/rest.go index 1c5ec8527c..f73074c0c1 100644 --- a/x/market/client/rest/rest.go +++ b/x/market/client/rest/rest.go @@ -5,10 +5,9 @@ import ( "net/http" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/types/rest" "github.com/gorilla/mux" - "github.com/akash-network/node/x/market/query" + "pkg.akt.dev/akashd/x/market/query" ) // RegisterRoutes registers all query routes diff --git a/x/market/genesis.go b/x/market/genesis.go index b38e25f1b2..64acd7e7b0 100644 --- a/x/market/genesis.go +++ b/x/market/genesis.go @@ -3,17 +3,18 @@ package market import ( "encoding/json" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + "pkg.akt.dev/go/node/market/v1" + "pkg.akt.dev/go/node/market/v1beta5" - "github.com/akash-network/node/x/market/keeper" + "pkg.akt.dev/akashd/x/market/keeper" ) // ValidateGenesis does validation check of the Genesis -func ValidateGenesis(data *types.GenesisState) error { +func ValidateGenesis(data *v1beta5.GenesisState) error { if err := data.Params.Validate(); err != nil { return err } @@ -23,42 +24,42 @@ func ValidateGenesis(data *types.GenesisState) error { // DefaultGenesisState returns default genesis state as raw bytes for the market // module. -func DefaultGenesisState() *types.GenesisState { - return &types.GenesisState{ - Params: types.DefaultParams(), +func DefaultGenesisState() *v1beta5.GenesisState { + return &v1beta5.GenesisState{ + Params: v1beta5.DefaultParams(), } } // InitGenesis initiate genesis state and return updated validator details -func InitGenesis(ctx sdk.Context, keeper keeper.IKeeper, data *types.GenesisState) []abci.ValidatorUpdate { +func InitGenesis(ctx sdk.Context, keeper keeper.IKeeper, data *v1beta5.GenesisState) []abci.ValidatorUpdate { keeper.SetParams(ctx, data.Params) return []abci.ValidatorUpdate{} } // ExportGenesis returns genesis state as raw bytes for the market module -func ExportGenesis(ctx sdk.Context, k keeper.IKeeper) *types.GenesisState { +func ExportGenesis(ctx sdk.Context, k keeper.IKeeper) *v1beta5.GenesisState { params := k.GetParams(ctx) - var bids []types.Bid - var leases []types.Lease - var orders []types.Order + var bids v1beta5.Bids + var leases v1.Leases + var orders v1beta5.Orders - k.WithLeases(ctx, func(lease types.Lease) bool { + k.WithLeases(ctx, func(lease v1.Lease) bool { leases = append(leases, lease) return false }) - k.WithOrders(ctx, func(order types.Order) bool { + k.WithOrders(ctx, func(order v1beta5.Order) bool { orders = append(orders, order) return false }) - k.WithBids(ctx, func(bid types.Bid) bool { + k.WithBids(ctx, func(bid v1beta5.Bid) bool { bids = append(bids, bid) return false }) - return &types.GenesisState{ + return &v1beta5.GenesisState{ Params: params, Orders: orders, Leases: leases, @@ -68,8 +69,8 @@ func ExportGenesis(ctx sdk.Context, k keeper.IKeeper) *types.GenesisState { // GetGenesisStateFromAppState returns x/market GenesisState given raw application // genesis state. -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *types.GenesisState { - var genesisState types.GenesisState +func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *v1beta5.GenesisState { + var genesisState v1beta5.GenesisState if appState[ModuleName] != nil { cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) diff --git a/x/market/handler/handler.go b/x/market/handler/handler.go index 8681a0cc5f..1fe4426065 100644 --- a/x/market/handler/handler.go +++ b/x/market/handler/handler.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta5" ) // NewHandler returns a handler for "market" type messages diff --git a/x/market/handler/handler_test.go b/x/market/handler/handler_test.go index cb78c5769d..533f33ac0c 100644 --- a/x/market/handler/handler_test.go +++ b/x/market/handler/handler_test.go @@ -7,20 +7,21 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + v1 "pkg.akt.dev/go/node/market/v1" + "github.com/cometbft/cometbft/libs/rand" sdktestdata "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/tendermint/tendermint/libs/rand" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - akashtypes "github.com/akash-network/akash-api/go/node/types/v1beta3" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta5" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" + attr "pkg.akt.dev/go/node/types/attributes/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/market/handler" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/market/handler" ) type testSuite struct { @@ -65,7 +66,7 @@ func TestCreateBidValid(t *testing.T) { provider := suite.createProvider(gspec.Requirements.Attributes).Owner msg := &types.MsgCreateBid{ - Order: order.ID(), + OrderID: order.ID, Provider: provider, Price: sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(1)), Deposit: types.DefaultBidMinDeposit, @@ -78,7 +79,7 @@ func TestCreateBidValid(t *testing.T) { providerAddr, err := sdk.AccAddressFromBech32(provider) require.NoError(t, err) - bid := types.MakeBidID(order.ID(), providerAddr) + bid := v1.MakeBidID(order.ID, providerAddr) t.Run("ensure event created", func(t *testing.T) { t.Skip("EVENTS TESTING") @@ -102,7 +103,7 @@ func TestCreateBidInvalidPrice(t *testing.T) { provider := suite.createProvider(gspec.Requirements.Attributes).Owner msg := &types.MsgCreateBid{ - Order: order.ID(), + OrderID: order.ID, Provider: provider, Price: sdk.DecCoin{}, } @@ -113,7 +114,7 @@ func TestCreateBidInvalidPrice(t *testing.T) { providerAddr, err := sdk.AccAddressFromBech32(provider) require.NoError(t, err) - _, found := suite.MarketKeeper().GetBid(suite.Context(), types.MakeBidID(order.ID(), providerAddr)) + _, found := suite.MarketKeeper().GetBid(suite.Context(), v1.MakeBidID(order.ID, providerAddr)) require.False(t, found) } @@ -121,7 +122,7 @@ func TestCreateBidNonExistingOrder(t *testing.T) { suite := setupTestSuite(t) msg := &types.MsgCreateBid{ - Order: types.OrderID{Owner: testutil.AccAddress(t).String()}, + OrderID: v1.OrderID{Owner: testutil.AccAddress(t).String()}, Provider: testutil.AccAddress(t).String(), Price: testutil.AkashDecCoinRandom(t), } @@ -132,7 +133,7 @@ func TestCreateBidNonExistingOrder(t *testing.T) { providerAddr, _ := sdk.AccAddressFromBech32(msg.Provider) - _, found := suite.MarketKeeper().GetBid(suite.Context(), types.MakeBidID(msg.Order, providerAddr)) + _, found := suite.MarketKeeper().GetBid(suite.Context(), v1.MakeBidID(msg.OrderID, providerAddr)) require.False(t, found) } @@ -141,10 +142,10 @@ func TestCreateBidClosedOrder(t *testing.T) { order, gspec := suite.createOrder(nil) - suite.MarketKeeper().OnOrderClosed(suite.Context(), order) + _ = suite.MarketKeeper().OnOrderClosed(suite.Context(), order) msg := &types.MsgCreateBid{ - Order: order.ID(), + OrderID: order.ID, Provider: suite.createProvider(gspec.Requirements.Attributes).Owner, Price: sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(math.MaxInt64)), } @@ -165,7 +166,7 @@ func TestCreateBidOverprice(t *testing.T) { order, gspec := suite.createOrder(resources) msg := &types.MsgCreateBid{ - Order: order.ID(), + OrderID: order.ID, Provider: suite.createProvider(gspec.Requirements.Attributes).Owner, Price: sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(math.MaxInt64)), } @@ -181,7 +182,7 @@ func TestCreateBidInvalidProvider(t *testing.T) { order, _ := suite.createOrder(testutil.Resources(t)) msg := &types.MsgCreateBid{ - Order: order.ID(), + OrderID: order.ID, Provider: "", Price: sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(1)), } @@ -197,7 +198,7 @@ func TestCreateBidInvalidAttributes(t *testing.T) { order, _ := suite.createOrder(testutil.Resources(t)) msg := &types.MsgCreateBid{ - Order: order.ID(), + OrderID: order.ID, Provider: suite.createProvider(testutil.Attributes(t)).Owner, Price: sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(1)), } @@ -213,7 +214,7 @@ func TestCreateBidAlreadyExists(t *testing.T) { order, gspec := suite.createOrder(testutil.Resources(t)) msg := &types.MsgCreateBid{ - Order: order.ID(), + OrderID: order.ID, Provider: suite.createProvider(gspec.Requirements.Attributes).Owner, Price: sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(1)), Deposit: types.DefaultBidMinDeposit, @@ -292,7 +293,7 @@ func TestCloseBidNonExisting(t *testing.T) { require.NoError(t, err) msg := &types.MsgCloseBid{ - BidID: types.MakeBidID(order.ID(), providerAddr), + ID: v1.MakeBidID(order.ID, providerAddr), } res, err := suite.handler(suite.Context(), msg) @@ -308,7 +309,7 @@ func TestCloseBidUnknownLease(t *testing.T) { suite.MarketKeeper().OnBidMatched(suite.Context(), bid) msg := &types.MsgCloseBid{ - BidID: bid.ID(), + ID: bid.ID, } res, err := suite.handler(suite.Context(), msg) @@ -322,7 +323,7 @@ func TestCloseBidValid(t *testing.T) { _, bid, _ := suite.createLease() msg := &types.MsgCloseBid{ - BidID: bid.ID(), + ID: bid.ID, } res, err := suite.handler(suite.Context(), msg) @@ -336,7 +337,7 @@ func TestCloseBidValid(t *testing.T) { dev := iev.(types.EventBidClosed) - require.Equal(t, msg.BidID, dev.ID) + require.Equal(t, msg.ID, dev.ID) }) } @@ -346,7 +347,7 @@ func TestCloseBidWithStateOpen(t *testing.T) { bid, _ := suite.createBid() msg := &types.MsgCloseBid{ - BidID: bid.ID(), + ID: bid.ID, } res, err := suite.handler(suite.Context(), msg) @@ -360,7 +361,7 @@ func TestCloseBidWithStateOpen(t *testing.T) { dev := iev.(types.EventBidClosed) - require.Equal(t, msg.BidID, dev.ID) + require.Equal(t, msg.ID, dev.ID) }) } @@ -386,7 +387,7 @@ func TestCloseBidUnknownOrder(t *testing.T) { suite := setupTestSuite(t) group := testutil.DeploymentGroup(t, testutil.DeploymentID(t), 0) - orderID := types.MakeOrderID(group.ID(), 1) + orderID := v1.MakeOrderID(group.ID, 1) provider := testutil.AccAddress(t) price := sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(int64(rand.Uint16()))) roffer := types.ResourceOfferFromRU(group.GroupSpec.Resources) @@ -394,10 +395,11 @@ func TestCloseBidUnknownOrder(t *testing.T) { bid, err := suite.MarketKeeper().CreateBid(suite.Context(), orderID, provider, price, roffer) require.NoError(t, err) - suite.MarketKeeper().CreateLease(suite.Context(), bid) + err = suite.MarketKeeper().CreateLease(suite.Context(), bid) + require.NoError(t, err) msg := &types.MsgCloseBid{ - BidID: bid.ID(), + ID: bid.ID, } res, err := suite.handler(suite.Context(), msg) @@ -405,15 +407,17 @@ func TestCloseBidUnknownOrder(t *testing.T) { require.Error(t, err) } -func (st *testSuite) createLease() (types.LeaseID, types.Bid, types.Order) { +func (st *testSuite) createLease() (v1.LeaseID, types.Bid, types.Order) { st.t.Helper() bid, order := st.createBid() - st.MarketKeeper().CreateLease(st.Context(), bid) + err := st.MarketKeeper().CreateLease(st.Context(), bid) + require.NoError(st.t, err) + st.MarketKeeper().OnBidMatched(st.Context(), bid) st.MarketKeeper().OnOrderMatched(st.Context(), order) - lid := types.MakeLeaseID(bid.ID()) + lid := v1.MakeLeaseID(bid.ID) return lid, bid, order } @@ -424,11 +428,11 @@ func (st *testSuite) createBid() (types.Bid, types.Order) { price := sdk.NewDecCoin(testutil.CoinDenom, sdk.NewInt(int64(rand.Uint16()))) roffer := types.ResourceOfferFromRU(gspec.Resources) - bid, err := st.MarketKeeper().CreateBid(st.Context(), order.ID(), provider, price, roffer) + bid, err := st.MarketKeeper().CreateBid(st.Context(), order.ID, provider, price, roffer) require.NoError(st.t, err) - require.Equal(st.t, order.ID(), bid.ID().OrderID()) + require.Equal(st.t, order.ID, bid.ID.OrderID()) require.Equal(st.t, price, bid.Price) - require.Equal(st.t, provider.String(), bid.ID().Provider) + require.Equal(st.t, provider.String(), bid.ID.Provider) return bid, order } @@ -436,22 +440,22 @@ func (st *testSuite) createOrder(resources dtypes.ResourceUnits) (types.Order, d st.t.Helper() deployment := testutil.Deployment(st.t) - group := testutil.DeploymentGroup(st.t, deployment.ID(), 0) + group := testutil.DeploymentGroup(st.t, deployment.ID, 0) group.GroupSpec.Resources = resources err := st.DeploymentKeeper().Create(st.Context(), deployment, []dtypes.Group{group}) require.NoError(st.t, err) - order, err := st.MarketKeeper().CreateOrder(st.Context(), group.ID(), group.GroupSpec) + order, err := st.MarketKeeper().CreateOrder(st.Context(), group.ID, group.GroupSpec) require.NoError(st.t, err) - require.Equal(st.t, group.ID(), order.ID().GroupID()) - require.Equal(st.t, uint32(1), order.ID().OSeq) - require.Equal(st.t, types.OrderOpen, order.State) + require.Equal(st.t, group.ID, order.ID.GroupID()) + require.Equal(st.t, uint32(1), order.ID.OSeq) + require.Equal(st.t, v1.OrderOpen, order.State) return order, group.GroupSpec } -func (st *testSuite) createProvider(attr []akashtypes.Attribute) ptypes.Provider { +func (st *testSuite) createProvider(attr attr.Attributes) ptypes.Provider { st.t.Helper() prov := ptypes.Provider{ diff --git a/x/market/handler/keepers.go b/x/market/handler/keepers.go index 9a08f139bd..77576e7c8a 100644 --- a/x/market/handler/keepers.go +++ b/x/market/handler/keepers.go @@ -4,12 +4,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" + atypes "pkg.akt.dev/go/node/audit/v1" + dtypes "pkg.akt.dev/go/node/deployment/v1" + dbeta "pkg.akt.dev/go/node/deployment/v1beta4" + etypes "pkg.akt.dev/go/node/escrow/v1" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" - "github.com/akash-network/node/x/market/keeper" + "pkg.akt.dev/akashd/x/market/keeper" ) type EscrowKeeper interface { @@ -33,9 +34,9 @@ type AuditKeeper interface { // DeploymentKeeper Interface includes deployment methods type DeploymentKeeper interface { - GetGroup(ctx sdk.Context, id dtypes.GroupID) (dtypes.Group, bool) + GetGroup(ctx sdk.Context, id dtypes.GroupID) (dbeta.Group, bool) OnBidClosed(ctx sdk.Context, id dtypes.GroupID) error - OnLeaseClosed(ctx sdk.Context, id dtypes.GroupID) (dtypes.Group, error) + OnLeaseClosed(ctx sdk.Context, id dtypes.GroupID) (dbeta.Group, error) } // Keepers include all modules keepers diff --git a/x/market/handler/server.go b/x/market/handler/server.go index f96defcf1c..40c4f1fc6b 100644 --- a/x/market/handler/server.go +++ b/x/market/handler/server.go @@ -6,11 +6,12 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" + v1 "pkg.akt.dev/go/node/market/v1" - atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" + atypes "pkg.akt.dev/go/node/audit/v1" + dbeta "pkg.akt.dev/go/node/deployment/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta5" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" ) type msgServer struct { @@ -38,11 +39,11 @@ func (ms msgServer) CreateBid(goCtx context.Context, msg *types.MsgCreateBid) (* return nil, fmt.Errorf("%w: mininum:%v received:%v", types.ErrInvalidDeposit, minDeposit, msg.Deposit) } - if ms.keepers.Market.BidCountForOrder(ctx, msg.Order) > params.OrderMaxBids { + if ms.keepers.Market.BidCountForOrder(ctx, msg.OrderID) > params.OrderMaxBids { return nil, fmt.Errorf("%w: too many existing bids (%v)", types.ErrInvalidBid, params.OrderMaxBids) } - order, found := ms.keepers.Market.GetOrder(ctx, msg.Order) + order, found := ms.keepers.Market.GetOrder(ctx, msg.OrderID) if !found { return nil, types.ErrOrderNotFound } @@ -88,14 +89,14 @@ func (ms msgServer) CreateBid(goCtx context.Context, msg *types.MsgCreateBid) (* return nil, types.ErrCapabilitiesMismatch } - bid, err := ms.keepers.Market.CreateBid(ctx, msg.Order, provider, msg.Price, msg.ResourcesOffer) + bid, err := ms.keepers.Market.CreateBid(ctx, msg.OrderID, provider, msg.Price, msg.ResourcesOffer) if err != nil { return nil, err } // create escrow account for this bid if err := ms.keepers.Escrow.AccountCreate(ctx, - types.EscrowAccountForBid(bid.ID()), + types.EscrowAccountForBid(bid.ID), provider, provider, // bids currently don't support deposits by non-owners msg.Deposit); err != nil { @@ -109,45 +110,45 @@ func (ms msgServer) CreateBid(goCtx context.Context, msg *types.MsgCreateBid) (* func (ms msgServer) CloseBid(goCtx context.Context, msg *types.MsgCloseBid) (*types.MsgCloseBidResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - bid, found := ms.keepers.Market.GetBid(ctx, msg.BidID) + bid, found := ms.keepers.Market.GetBid(ctx, msg.ID) if !found { return nil, types.ErrUnknownBid } - order, found := ms.keepers.Market.GetOrder(ctx, msg.BidID.OrderID()) + order, found := ms.keepers.Market.GetOrder(ctx, msg.ID.OrderID()) if !found { return nil, types.ErrUnknownOrderForBid } - if bid.State == types.BidOpen { - ms.keepers.Market.OnBidClosed(ctx, bid) + if bid.State == v1.BidOpen { + _ = ms.keepers.Market.OnBidClosed(ctx, bid) return &types.MsgCloseBidResponse{}, nil } - lease, found := ms.keepers.Market.GetLease(ctx, types.LeaseID(msg.BidID)) + lease, found := ms.keepers.Market.GetLease(ctx, v1.LeaseID(msg.ID)) if !found { return nil, types.ErrUnknownLeaseForBid } - if lease.State != types.LeaseActive { + if lease.State != v1.LeaseActive { return nil, types.ErrLeaseNotActive } - if bid.State != types.BidActive { + if bid.State != v1.BidActive { return nil, types.ErrBidNotActive } - if err := ms.keepers.Deployment.OnBidClosed(ctx, order.ID().GroupID()); err != nil { + if err := ms.keepers.Deployment.OnBidClosed(ctx, order.ID.GroupID()); err != nil { return nil, err } - ms.keepers.Market.OnLeaseClosed(ctx, lease, types.LeaseClosed) - ms.keepers.Market.OnBidClosed(ctx, bid) - ms.keepers.Market.OnOrderClosed(ctx, order) + _ = ms.keepers.Market.OnLeaseClosed(ctx, lease, v1.LeaseClosed) + _ = ms.keepers.Market.OnBidClosed(ctx, bid) + _ = ms.keepers.Market.OnOrderClosed(ctx, order) - ms.keepers.Escrow.PaymentClose(ctx, - dtypes.EscrowAccountForDeployment(lease.ID().DeploymentID()), - types.EscrowPaymentForLease(lease.ID())) + _ = ms.keepers.Escrow.PaymentClose(ctx, + dbeta.EscrowAccountForDeployment(lease.ID.DeploymentID()), + types.EscrowPaymentForLease(lease.ID)) telemetry.IncrCounter(1.0, "akash.order_closed") @@ -157,14 +158,14 @@ func (ms msgServer) CloseBid(goCtx context.Context, msg *types.MsgCloseBid) (*ty func (ms msgServer) WithdrawLease(goCtx context.Context, msg *types.MsgWithdrawLease) (*types.MsgWithdrawLeaseResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - _, found := ms.keepers.Market.GetLease(ctx, msg.LeaseID) + _, found := ms.keepers.Market.GetLease(ctx, msg.ID) if !found { return nil, types.ErrUnknownLease } if err := ms.keepers.Escrow.PaymentWithdraw(ctx, - dtypes.EscrowAccountForDeployment(msg.LeaseID.DeploymentID()), - types.EscrowPaymentForLease(msg.LeaseID), + dbeta.EscrowAccountForDeployment(msg.ID.DeploymentID()), + types.EscrowPaymentForLease(msg.ID), ); err != nil { return &types.MsgWithdrawLeaseResponse{}, err } @@ -180,7 +181,7 @@ func (ms msgServer) CreateLease(goCtx context.Context, msg *types.MsgCreateLease return &types.MsgCreateLeaseResponse{}, types.ErrBidNotFound } - if bid.State != types.BidOpen { + if bid.State != v1.BidOpen { return &types.MsgCreateLeaseResponse{}, types.ErrBidNotOpen } @@ -189,16 +190,16 @@ func (ms msgServer) CreateLease(goCtx context.Context, msg *types.MsgCreateLease return &types.MsgCreateLeaseResponse{}, types.ErrOrderNotFound } - if order.State != types.OrderOpen { + if order.State != v1.OrderOpen { return &types.MsgCreateLeaseResponse{}, types.ErrOrderNotOpen } - group, found := ms.keepers.Deployment.GetGroup(ctx, order.ID().GroupID()) + group, found := ms.keepers.Deployment.GetGroup(ctx, order.ID.GroupID()) if !found { return &types.MsgCreateLeaseResponse{}, types.ErrGroupNotFound } - if group.State != dtypes.GroupOpen { + if group.State != dbeta.GroupOpen { return &types.MsgCreateLeaseResponse{}, types.ErrGroupNotOpen } @@ -208,24 +209,24 @@ func (ms msgServer) CreateLease(goCtx context.Context, msg *types.MsgCreateLease } if err := ms.keepers.Escrow.PaymentCreate(ctx, - dtypes.EscrowAccountForDeployment(msg.BidID.DeploymentID()), + dbeta.EscrowAccountForDeployment(msg.BidID.DeploymentID()), types.EscrowPaymentForLease(msg.BidID.LeaseID()), owner, bid.Price); err != nil { return &types.MsgCreateLeaseResponse{}, err } - ms.keepers.Market.CreateLease(ctx, bid) + _ = ms.keepers.Market.CreateLease(ctx, bid) ms.keepers.Market.OnOrderMatched(ctx, order) ms.keepers.Market.OnBidMatched(ctx, bid) // close losing bids var lostbids []types.Bid ms.keepers.Market.WithBidsForOrder(ctx, msg.BidID.OrderID(), func(bid types.Bid) bool { - if bid.ID().Equals(msg.BidID) { + if bid.ID.Equals(msg.BidID) { return false } - if bid.State != types.BidOpen { + if bid.State != v1.BidOpen { return false } @@ -236,7 +237,7 @@ func (ms msgServer) CreateLease(goCtx context.Context, msg *types.MsgCreateLease for _, bid := range lostbids { ms.keepers.Market.OnBidLost(ctx, bid) if err := ms.keepers.Escrow.AccountClose(ctx, - types.EscrowAccountForBid(bid.ID())); err != nil { + types.EscrowAccountForBid(bid.ID)); err != nil { return &types.MsgCreateLeaseResponse{}, err } } @@ -247,51 +248,51 @@ func (ms msgServer) CreateLease(goCtx context.Context, msg *types.MsgCreateLease func (ms msgServer) CloseLease(goCtx context.Context, msg *types.MsgCloseLease) (*types.MsgCloseLeaseResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - order, found := ms.keepers.Market.GetOrder(ctx, msg.LeaseID.OrderID()) + order, found := ms.keepers.Market.GetOrder(ctx, msg.ID.OrderID()) if !found { return nil, types.ErrOrderNotFound } - if order.State != types.OrderActive { + if order.State != v1.OrderActive { return &types.MsgCloseLeaseResponse{}, types.ErrOrderClosed } - bid, found := ms.keepers.Market.GetBid(ctx, msg.LeaseID.BidID()) + bid, found := ms.keepers.Market.GetBid(ctx, msg.ID.BidID()) if !found { return &types.MsgCloseLeaseResponse{}, types.ErrBidNotFound } - if bid.State != types.BidActive { + if bid.State != v1.BidActive { return &types.MsgCloseLeaseResponse{}, types.ErrBidNotActive } - lease, found := ms.keepers.Market.GetLease(ctx, msg.LeaseID) + lease, found := ms.keepers.Market.GetLease(ctx, msg.ID) if !found { return &types.MsgCloseLeaseResponse{}, types.ErrLeaseNotFound } - if lease.State != types.LeaseActive { + if lease.State != v1.LeaseActive { return &types.MsgCloseLeaseResponse{}, types.ErrOrderClosed } - ms.keepers.Market.OnLeaseClosed(ctx, lease, types.LeaseClosed) - ms.keepers.Market.OnBidClosed(ctx, bid) - ms.keepers.Market.OnOrderClosed(ctx, order) + _ = ms.keepers.Market.OnLeaseClosed(ctx, lease, v1.LeaseClosed) + _ = ms.keepers.Market.OnBidClosed(ctx, bid) + _ = ms.keepers.Market.OnOrderClosed(ctx, order) if err := ms.keepers.Escrow.PaymentClose(ctx, - dtypes.EscrowAccountForDeployment(lease.ID().DeploymentID()), - types.EscrowPaymentForLease(lease.ID()), + dbeta.EscrowAccountForDeployment(lease.ID.DeploymentID()), + types.EscrowPaymentForLease(lease.ID), ); err != nil { return &types.MsgCloseLeaseResponse{}, err } - group, err := ms.keepers.Deployment.OnLeaseClosed(ctx, msg.LeaseID.GroupID()) + group, err := ms.keepers.Deployment.OnLeaseClosed(ctx, msg.ID.GroupID()) if err != nil { return &types.MsgCloseLeaseResponse{}, err } - if group.State != dtypes.GroupOpen { + if group.State != dbeta.GroupOpen { return &types.MsgCloseLeaseResponse{}, nil } - if _, err := ms.keepers.Market.CreateOrder(ctx, group.ID(), group.GroupSpec); err != nil { + if _, err := ms.keepers.Market.CreateOrder(ctx, group.ID, group.GroupSpec); err != nil { return &types.MsgCloseLeaseResponse{}, err } return &types.MsgCloseLeaseResponse{}, nil diff --git a/x/market/hooks/external.go b/x/market/hooks/external.go index 5ccdabf728..d4b55bdb15 100644 --- a/x/market/hooks/external.go +++ b/x/market/hooks/external.go @@ -3,23 +3,25 @@ package hooks import ( sdk "github.com/cosmos/cosmos-sdk/types" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" + dv1 "pkg.akt.dev/go/node/deployment/v1" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + mv1 "pkg.akt.dev/go/node/market/v1" + mtypes "pkg.akt.dev/go/node/market/v1beta5" ) type DeploymentKeeper interface { - GetDeployment(ctx sdk.Context, id dtypes.DeploymentID) (dtypes.Deployment, bool) - GetGroups(ctx sdk.Context, id dtypes.DeploymentID) []dtypes.Group - CloseDeployment(ctx sdk.Context, deployment dtypes.Deployment) - OnCloseGroup(ctx sdk.Context, group dtypes.Group, state dtypes.Group_State) error + GetDeployment(ctx sdk.Context, id dv1.DeploymentID) (dv1.Deployment, bool) + GetGroups(ctx sdk.Context, id dv1.DeploymentID) []dtypes.Group + CloseDeployment(ctx sdk.Context, deployment dv1.Deployment) error + OnCloseGroup(ctx sdk.Context, group dtypes.Group, state dtypes.GroupState) error } type MarketKeeper interface { - GetOrder(ctx sdk.Context, id mtypes.OrderID) (mtypes.Order, bool) - GetBid(ctx sdk.Context, id mtypes.BidID) (mtypes.Bid, bool) - GetLease(ctx sdk.Context, id mtypes.LeaseID) (mtypes.Lease, bool) - OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) - OnOrderClosed(ctx sdk.Context, order mtypes.Order) - OnBidClosed(ctx sdk.Context, bid mtypes.Bid) - OnLeaseClosed(ctx sdk.Context, lease mtypes.Lease, state mtypes.Lease_State) + GetOrder(ctx sdk.Context, id mv1.OrderID) (mtypes.Order, bool) + GetBid(ctx sdk.Context, id mv1.BidID) (mtypes.Bid, bool) + GetLease(ctx sdk.Context, id mv1.LeaseID) (mv1.Lease, bool) + OnGroupClosed(ctx sdk.Context, id dv1.GroupID) error + OnOrderClosed(ctx sdk.Context, order mtypes.Order) error + OnBidClosed(ctx sdk.Context, bid mtypes.Bid) error + OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.LeaseState) error } diff --git a/x/market/hooks/hooks.go b/x/market/hooks/hooks.go index b4ea5eec68..84aac8d1e1 100644 --- a/x/market/hooks/hooks.go +++ b/x/market/hooks/hooks.go @@ -3,10 +3,11 @@ package hooks import ( sdk "github.com/cosmos/cosmos-sdk/types" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" - - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" + dv1 "pkg.akt.dev/go/node/deployment/v1" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + etypes "pkg.akt.dev/go/node/escrow/v1" + mv1 "pkg.akt.dev/go/node/market/v1" + mtypes "pkg.akt.dev/go/node/market/v1beta5" ) type Hooks interface { @@ -37,20 +38,20 @@ func (h *hooks) OnEscrowAccountClosed(ctx sdk.Context, obj etypes.Account) { return } - if deployment.State != dtypes.DeploymentActive { + if deployment.State != dv1.DeploymentActive { return } - h.dkeeper.CloseDeployment(ctx, deployment) + _ = h.dkeeper.CloseDeployment(ctx, deployment) gstate := dtypes.GroupClosed if obj.State == etypes.AccountOverdrawn { gstate = dtypes.GroupInsufficientFunds } - for _, group := range h.dkeeper.GetGroups(ctx, deployment.ID()) { + for _, group := range h.dkeeper.GetGroups(ctx, deployment.ID) { if group.ValidateClosable() == nil { _ = h.dkeeper.OnCloseGroup(ctx, group, gstate) - h.mkeeper.OnGroupClosed(ctx, group.ID()) + _ = h.mkeeper.OnGroupClosed(ctx, group.ID) } } } @@ -66,7 +67,7 @@ func (h *hooks) OnEscrowPaymentClosed(ctx sdk.Context, obj etypes.FractionalPaym return } - if bid.State != mtypes.BidActive { + if bid.State != mv1.BidActive { return } @@ -80,12 +81,12 @@ func (h *hooks) OnEscrowPaymentClosed(ctx sdk.Context, obj etypes.FractionalPaym return } - h.mkeeper.OnOrderClosed(ctx, order) - h.mkeeper.OnBidClosed(ctx, bid) + _ = h.mkeeper.OnOrderClosed(ctx, order) + _ = h.mkeeper.OnBidClosed(ctx, bid) if obj.State == etypes.PaymentOverdrawn { - h.mkeeper.OnLeaseClosed(ctx, lease, mtypes.LeaseInsufficientFunds) + _ = h.mkeeper.OnLeaseClosed(ctx, lease, mv1.LeaseInsufficientFunds) } else { - h.mkeeper.OnLeaseClosed(ctx, lease, mtypes.LeaseClosed) + _ = h.mkeeper.OnLeaseClosed(ctx, lease, mv1.LeaseClosed) } } diff --git a/x/market/keeper/external.go b/x/market/keeper/external.go index 033b6d96f6..b30c4e1a9f 100644 --- a/x/market/keeper/external.go +++ b/x/market/keeper/external.go @@ -3,12 +3,12 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + v1 "pkg.akt.dev/go/node/escrow/v1" ) type EscrowKeeper interface { - GetAccount(ctx sdk.Context, id etypes.AccountID) (etypes.Account, error) - GetPayment(ctx sdk.Context, id etypes.AccountID, pid string) (etypes.FractionalPayment, error) - AccountClose(ctx sdk.Context, id etypes.AccountID) error - PaymentClose(ctx sdk.Context, id etypes.AccountID, pid string) error + GetAccount(ctx sdk.Context, id v1.AccountID) (v1.Account, error) + GetPayment(ctx sdk.Context, id v1.AccountID, pid string) (v1.FractionalPayment, error) + AccountClose(ctx sdk.Context, id v1.AccountID) error + PaymentClose(ctx sdk.Context, id v1.AccountID, pid string) error } diff --git a/x/market/keeper/grpc_query.go b/x/market/keeper/grpc_query.go index eeb455acc2..e6bb520bc4 100644 --- a/x/market/keeper/grpc_query.go +++ b/x/market/keeper/grpc_query.go @@ -10,10 +10,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + "pkg.akt.dev/go/node/market/v1" + types "pkg.akt.dev/go/node/market/v1beta5" - keys "github.com/akash-network/node/x/market/keeper/keys/v1beta4" + "pkg.akt.dev/akashd/x/market/keeper/keys" ) // Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper @@ -29,9 +30,9 @@ func (k Querier) Orders(c context.Context, req *types.QueryOrdersRequest) (*type return nil, status.Error(codes.InvalidArgument, "empty request") } - stateVal := types.Order_State(types.Order_State_value[req.Filters.State]) + stateVal := v1.OrderState(v1.OrderState_value[req.Filters.State]) - if req.Filters.State != "" && stateVal == types.OrderStateInvalid { + if req.Filters.State != "" && stateVal == v1.OrderStateInvalid { return nil, status.Error(codes.InvalidArgument, "invalid state value") } @@ -101,9 +102,9 @@ func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.Qu return nil, status.Error(codes.InvalidArgument, "empty request") } - stateVal := types.Bid_State(types.Bid_State_value[req.Filters.State]) + stateVal := v1.BidState(v1.BidState_value[req.Filters.State]) - if req.Filters.State != "" && stateVal == types.BidStateInvalid { + if req.Filters.State != "" && stateVal == v1.BidStateInvalid { return nil, status.Error(codes.InvalidArgument, "invalid state value") } @@ -129,7 +130,7 @@ func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.Qu // filter bids with provided filters if req.Filters.Accept(bid, stateVal) { if accumulate { - acct, err := k.ekeeper.GetAccount(ctx, types.EscrowAccountForBid(bid.BidID)) + acct, err := k.ekeeper.GetAccount(ctx, types.EscrowAccountForBid(bid.ID)) if err != nil { return true, err } @@ -176,7 +177,7 @@ func (k Querier) Bid(c context.Context, req *types.QueryBidRequest) (*types.Quer return nil, types.ErrBidNotFound } - acct, err := k.ekeeper.GetAccount(ctx, types.EscrowAccountForBid(bid.ID())) + acct, err := k.ekeeper.GetAccount(ctx, types.EscrowAccountForBid(bid.ID)) if err != nil { return nil, err } @@ -193,9 +194,9 @@ func (k Querier) Leases(c context.Context, req *types.QueryLeasesRequest) (*type return nil, status.Error(codes.InvalidArgument, "empty request") } - stateVal := types.Lease_State(types.Lease_State_value[req.Filters.State]) + stateVal := v1.LeaseState(v1.LeaseState_value[req.Filters.State]) - if req.Filters.State != "" && stateVal == types.LeaseStateInvalid { + if req.Filters.State != "" && stateVal == v1.LeaseStateInvalid { return nil, status.Error(codes.InvalidArgument, "invalid state value") } @@ -210,7 +211,7 @@ func (k Querier) Leases(c context.Context, req *types.QueryLeasesRequest) (*type searchedStore := prefix.NewStore(store, searchPrefix) pageRes, err := sdkquery.FilteredPaginate(searchedStore, req.Pagination, func(key []byte, value []byte, accumulate bool) (bool, error) { - var lease types.Lease + var lease v1.Lease if isSecondaryPrefix { secondaryKey := value @@ -227,8 +228,8 @@ func (k Querier) Leases(c context.Context, req *types.QueryLeasesRequest) (*type if req.Filters.Accept(lease, stateVal) { if accumulate { payment, err := k.ekeeper.GetPayment(ctx, - dtypes.EscrowAccountForDeployment(lease.ID().DeploymentID()), - types.EscrowPaymentForLease(lease.ID())) + dtypes.EscrowAccountForDeployment(lease.ID.DeploymentID()), + types.EscrowPaymentForLease(lease.ID)) if err != nil { return true, err } @@ -276,8 +277,8 @@ func (k Querier) Lease(c context.Context, req *types.QueryLeaseRequest) (*types. } payment, err := k.ekeeper.GetPayment(ctx, - dtypes.EscrowAccountForDeployment(lease.ID().DeploymentID()), - types.EscrowPaymentForLease(lease.ID())) + dtypes.EscrowAccountForDeployment(lease.ID.DeploymentID()), + types.EscrowPaymentForLease(lease.ID)) if err != nil { return nil, err } diff --git a/x/market/keeper/grpc_query_test.go b/x/market/keeper/grpc_query_test.go index b0bfeedd52..4c52d667a4 100644 --- a/x/market/keeper/grpc_query_test.go +++ b/x/market/keeper/grpc_query_test.go @@ -12,11 +12,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1" + "pkg.akt.dev/go/node/market/v1beta5" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/market/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/market/keeper" ) type grpcTestSuite struct { @@ -25,7 +26,7 @@ type grpcTestSuite struct { ctx sdk.Context keeper keeper.IKeeper - queryClient types.QueryClient + queryClient v1beta5.QueryClient } func setupTest(t *testing.T) *grpcTestSuite { @@ -41,8 +42,8 @@ func setupTest(t *testing.T) *grpcTestSuite { querier := suite.keeper.NewQuerier() queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.App().InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, querier) - suite.queryClient = types.NewQueryClient(queryHelper) + v1beta5.RegisterQueryServer(queryHelper, querier) + suite.queryClient = v1beta5.NewQueryClient(queryHelper) return suite } @@ -54,8 +55,8 @@ func TestGRPCQueryOrder(t *testing.T) { order, _ := createOrder(t, suite.ctx, suite.keeper) var ( - req *types.QueryOrderRequest - expOrder types.Order + req *v1beta5.QueryOrderRequest + expOrder v1beta5.Order ) testCases := []struct { @@ -66,21 +67,21 @@ func TestGRPCQueryOrder(t *testing.T) { { "empty request", func() { - req = &types.QueryOrderRequest{} + req = &v1beta5.QueryOrderRequest{} }, false, }, { "invalid request", func() { - req = &types.QueryOrderRequest{ID: types.OrderID{}} + req = &v1beta5.QueryOrderRequest{ID: types.OrderID{}} }, false, }, { "order not found", func() { - req = &types.QueryOrderRequest{ID: types.OrderID{ + req = &v1beta5.QueryOrderRequest{ID: types.OrderID{ Owner: testutil.AccAddress(t).String(), DSeq: 32, GSeq: 43, @@ -92,7 +93,7 @@ func TestGRPCQueryOrder(t *testing.T) { { "success", func() { - req = &types.QueryOrderRequest{ID: order.OrderID} + req = &v1beta5.QueryOrderRequest{ID: order.ID} expOrder = order }, true, @@ -128,7 +129,7 @@ func TestGRPCQueryOrders(t *testing.T) { order2, _ := createOrder(t, suite.ctx, suite.keeper) suite.keeper.OnOrderMatched(suite.ctx, order2) - var req *types.QueryOrdersRequest + var req *v1beta5.QueryOrdersRequest testCases := []struct { msg string @@ -138,15 +139,15 @@ func TestGRPCQueryOrders(t *testing.T) { { "query orders without any filters and pagination", func() { - req = &types.QueryOrdersRequest{} + req = &v1beta5.QueryOrdersRequest{} }, 2, }, { "query orders with filters having non existent data", func() { - req = &types.QueryOrdersRequest{ - Filters: types.OrderFilters{ + req = &v1beta5.QueryOrdersRequest{ + Filters: v1beta5.OrderFilters{ OSeq: 37, State: types.OrderActive.String(), }} @@ -156,14 +157,14 @@ func TestGRPCQueryOrders(t *testing.T) { { "query orders with state filter", func() { - req = &types.QueryOrdersRequest{Filters: types.OrderFilters{State: types.OrderActive.String()}} + req = &v1beta5.QueryOrdersRequest{Filters: v1beta5.OrderFilters{State: types.OrderActive.String()}} }, 1, }, { "query orders with pagination", func() { - req = &types.QueryOrdersRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} + req = &v1beta5.QueryOrdersRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} }, 1, }, @@ -186,13 +187,13 @@ func TestGRPCQueryOrders(t *testing.T) { type orderFilterModifier struct { fieldName string - f func(orderID types.OrderID, filter types.OrderFilters) types.OrderFilters + f func(orderID types.OrderID, filter v1beta5.OrderFilters) v1beta5.OrderFilters getField func(orderID types.OrderID) interface{} } type bidFilterModifier struct { fieldName string - f func(bidID types.BidID, filter types.BidFilters) types.BidFilters + f func(bidID types.BidID, filter v1beta5.BidFilters) v1beta5.BidFilters getField func(bidID types.BidID) interface{} } @@ -211,15 +212,15 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { orderC, _ := createOrder(t, suite.ctx, suite.keeper) orders := []types.OrderID{ - orderA.GetOrderID(), - orderB.GetOrderID(), - orderC.GetOrderID(), + orderA.ID, + orderB.ID, + orderC.ID, } modifiers := []orderFilterModifier{ { "owner", - func(orderID types.OrderID, filter types.OrderFilters) types.OrderFilters { + func(orderID types.OrderID, filter v1beta5.OrderFilters) v1beta5.OrderFilters { filter.Owner = orderID.GetOwner() return filter }, @@ -229,7 +230,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { }, { "dseq", - func(orderID types.OrderID, filter types.OrderFilters) types.OrderFilters { + func(orderID types.OrderID, filter v1beta5.OrderFilters) v1beta5.OrderFilters { filter.DSeq = orderID.DSeq return filter }, @@ -239,7 +240,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { }, { "gseq", - func(orderID types.OrderID, filter types.OrderFilters) types.OrderFilters { + func(orderID types.OrderID, filter v1beta5.OrderFilters) v1beta5.OrderFilters { filter.GSeq = orderID.GSeq return filter }, @@ -249,7 +250,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { }, { "oseq", - func(orderID types.OrderID, filter types.OrderFilters) types.OrderFilters { + func(orderID types.OrderID, filter v1beta5.OrderFilters) v1beta5.OrderFilters { filter.OSeq = orderID.OSeq return filter }, @@ -263,8 +264,8 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { for _, orderID := range orders { for _, m := range modifiers { - req := &types.QueryOrdersRequest{ - Filters: m.f(orderID, types.OrderFilters{}), + req := &v1beta5.QueryOrdersRequest{ + Filters: m.f(orderID, v1beta5.OrderFilters{}), } res, err := suite.queryClient.Orders(ctx, req) @@ -275,7 +276,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { require.GreaterOrEqual(t, len(res.Orders), 1, "testing %v", m.fieldName) for _, order := range res.Orders { - resultOrderID := order.GetOrderID() + resultOrderID := order.ID require.Equal(t, m.getField(orderID), m.getField(resultOrderID), "testing %v", m.fieldName) } } @@ -299,7 +300,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { } for _, orderID := range orders { - filter := types.OrderFilters{} + filter := v1beta5.OrderFilters{} msg := strings.Builder{} msg.WriteString("testing filtering on: ") for k, useModifier := range modifiersToUse { @@ -312,7 +313,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryOrdersRequest{ + req := &v1beta5.QueryOrdersRequest{ Filters: filter, } @@ -324,7 +325,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { require.GreaterOrEqual(t, len(res.Orders), 1, msg.String()) for _, order := range res.Orders { - resultOrderID := order.GetOrderID() + resultOrderID := order.ID for k, useModifier := range modifiersToUse { if !useModifier { continue @@ -335,7 +336,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { } } - filter := types.OrderFilters{} + filter := v1beta5.OrderFilters{} msg := strings.Builder{} msg.WriteString("testing filtering on (using non matching ID): ") for k, useModifier := range modifiersToUse { @@ -348,7 +349,7 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryOrdersRequest{ + req := &v1beta5.QueryOrdersRequest{ Filters: filter, } @@ -365,8 +366,8 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { for _, orderID := range orders { // Query by owner - req := &types.QueryOrdersRequest{ - Filters: types.OrderFilters{ + req := &v1beta5.QueryOrdersRequest{ + Filters: v1beta5.OrderFilters{ Owner: orderID.Owner, }, } @@ -378,11 +379,11 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { // Just 1 result require.Len(t, res.Orders, 1) orderResult := res.Orders[0] - require.Equal(t, orderID, orderResult.GetOrderID()) + require.Equal(t, orderID, orderResult.ID) // Query with valid DSeq - req = &types.QueryOrdersRequest{ - Filters: types.OrderFilters{ + req = &v1beta5.QueryOrdersRequest{ + Filters: v1beta5.OrderFilters{ Owner: orderID.Owner, DSeq: orderID.DSeq, }, @@ -395,11 +396,11 @@ func TestGRPCQueryOrdersWithFilter(t *testing.T) { require.NotNil(t, res) require.Len(t, res.Orders, 1) orderResult = res.Orders[0] - require.Equal(t, orderID, orderResult.GetOrderID()) + require.Equal(t, orderID, orderResult.ID) // Query with a bogus DSeq - req = &types.QueryOrdersRequest{ - Filters: types.OrderFilters{ + req = &v1beta5.QueryOrdersRequest{ + Filters: v1beta5.OrderFilters{ Owner: orderID.Owner, DSeq: orderID.DSeq + 1, }, @@ -423,15 +424,15 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { bidC, _ := createBid(t, suite.TestSuite) bids := []types.BidID{ - bidA.GetBidID(), - bidB.GetBidID(), - bidC.GetBidID(), + bidA.ID, + bidB.ID, + bidC.ID, } modifiers := []bidFilterModifier{ { "owner", - func(bidID types.BidID, filter types.BidFilters) types.BidFilters { + func(bidID types.BidID, filter v1beta5.BidFilters) v1beta5.BidFilters { filter.Owner = bidID.GetOwner() return filter }, @@ -441,7 +442,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { }, { "dseq", - func(bidID types.BidID, filter types.BidFilters) types.BidFilters { + func(bidID types.BidID, filter v1beta5.BidFilters) v1beta5.BidFilters { filter.DSeq = bidID.DSeq return filter }, @@ -451,7 +452,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { }, { "gseq", - func(bidID types.BidID, filter types.BidFilters) types.BidFilters { + func(bidID types.BidID, filter v1beta5.BidFilters) v1beta5.BidFilters { filter.GSeq = bidID.GSeq return filter }, @@ -461,7 +462,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { }, { "oseq", - func(bidID types.BidID, filter types.BidFilters) types.BidFilters { + func(bidID types.BidID, filter v1beta5.BidFilters) v1beta5.BidFilters { filter.OSeq = bidID.OSeq return filter }, @@ -471,7 +472,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { }, { "provider", - func(bidID types.BidID, filter types.BidFilters) types.BidFilters { + func(bidID types.BidID, filter v1beta5.BidFilters) v1beta5.BidFilters { filter.Provider = bidID.Provider return filter }, @@ -485,8 +486,8 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { for _, bidID := range bids { for _, m := range modifiers { - req := &types.QueryBidsRequest{ - Filters: m.f(bidID, types.BidFilters{}), + req := &v1beta5.QueryBidsRequest{ + Filters: m.f(bidID, v1beta5.BidFilters{}), } res, err := suite.queryClient.Bids(ctx, req) @@ -497,7 +498,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { require.GreaterOrEqual(t, len(res.Bids), 1, "testing %v", m.fieldName) for _, bid := range res.Bids { - resultBidID := bid.GetBid().BidID + resultBidID := bid.GetBid().ID require.Equal(t, m.getField(bidID), m.getField(resultBidID), "testing %v", m.fieldName) } } @@ -522,7 +523,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { } for _, bidID := range bids { - filter := types.BidFilters{} + filter := v1beta5.BidFilters{} msg := strings.Builder{} msg.WriteString("testing filtering on: ") for k, useModifier := range modifiersToUse { @@ -535,7 +536,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryBidsRequest{ + req := &v1beta5.QueryBidsRequest{ Filters: filter, } @@ -547,7 +548,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { require.GreaterOrEqual(t, len(res.Bids), 1, msg.String()) for _, bid := range res.Bids { - resultBidID := bid.GetBid().BidID + resultBidID := bid.GetBid().ID for k, useModifier := range modifiersToUse { if !useModifier { continue @@ -558,7 +559,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { } } - filter := types.BidFilters{} + filter := v1beta5.BidFilters{} msg := strings.Builder{} msg.WriteString("testing filtering on (using non matching ID): ") for k, useModifier := range modifiersToUse { @@ -571,7 +572,7 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryBidsRequest{ + req := &v1beta5.QueryBidsRequest{ Filters: filter, } @@ -588,8 +589,8 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { for _, bidID := range bids { // Query by owner - req := &types.QueryBidsRequest{ - Filters: types.BidFilters{ + req := &v1beta5.QueryBidsRequest{ + Filters: v1beta5.BidFilters{ Owner: bidID.Owner, }, } @@ -601,11 +602,11 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { // Just 1 result require.Len(t, res.Bids, 1) bidResult := res.Bids[0] - require.Equal(t, bidID, bidResult.GetBid().BidID) + require.Equal(t, bidID, bidResult.GetBid().ID) // Query with valid DSeq - req = &types.QueryBidsRequest{ - Filters: types.BidFilters{ + req = &v1beta5.QueryBidsRequest{ + Filters: v1beta5.BidFilters{ Owner: bidID.Owner, DSeq: bidID.DSeq, }, @@ -618,11 +619,11 @@ func TestGRPCQueryBidsWithFilter(t *testing.T) { require.NotNil(t, res) require.Len(t, res.Bids, 1) bidResult = res.Bids[0] - require.Equal(t, bidID, bidResult.GetBid().BidID) + require.Equal(t, bidID, bidResult.GetBid().ID) // Query with a bogus DSeq - req = &types.QueryBidsRequest{ - Filters: types.BidFilters{ + req = &v1beta5.QueryBidsRequest{ + Filters: v1beta5.BidFilters{ Owner: bidID.Owner, DSeq: bidID.DSeq + 1, }, @@ -708,7 +709,7 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { for _, leaseID := range leases { for _, m := range modifiers { - req := &types.QueryLeasesRequest{ + req := &v1beta5.QueryLeasesRequest{ Filters: m.f(leaseID, types.LeaseFilters{}), } @@ -720,7 +721,7 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { require.GreaterOrEqual(t, len(res.Leases), 1, "testing %v", m.fieldName) for _, lease := range res.Leases { - resultLeaseID := lease.Lease.GetLeaseID() + resultLeaseID := lease.Lease.ID require.Equal(t, m.getField(leaseID), m.getField(resultLeaseID), "testing %v", m.fieldName) } } @@ -758,7 +759,7 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryLeasesRequest{ + req := &v1beta5.QueryLeasesRequest{ Filters: filter, } @@ -770,7 +771,7 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { require.GreaterOrEqual(t, len(res.Leases), 1, msg.String()) for _, lease := range res.Leases { - resultLeaseID := lease.GetLease().LeaseID + resultLeaseID := lease.GetLease().ID for k, useModifier := range modifiersToUse { if !useModifier { continue @@ -794,7 +795,7 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { msg.WriteString(", ") } - req := &types.QueryLeasesRequest{ + req := &v1beta5.QueryLeasesRequest{ Filters: filter, } @@ -811,7 +812,7 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { for _, leaseID := range leases { // Query by owner - req := &types.QueryLeasesRequest{ + req := &v1beta5.QueryLeasesRequest{ Filters: types.LeaseFilters{ Owner: leaseID.Owner, }, @@ -824,10 +825,10 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { // Just 1 result require.Len(t, res.Leases, 1) leaseResult := res.Leases[0] - require.Equal(t, leaseID, leaseResult.GetLease().LeaseID) + require.Equal(t, leaseID, leaseResult.GetLease().ID) // Query with valid DSeq - req = &types.QueryLeasesRequest{ + req = &v1beta5.QueryLeasesRequest{ Filters: types.LeaseFilters{ Owner: leaseID.Owner, DSeq: leaseID.DSeq, @@ -841,10 +842,10 @@ func TestGRPCQueryLeasesWithFilter(t *testing.T) { require.NotNil(t, res) require.Len(t, res.Leases, 1) leaseResult = res.Leases[0] - require.Equal(t, leaseID, leaseResult.GetLease().LeaseID) + require.Equal(t, leaseID, leaseResult.GetLease().ID) // Query with a bogus DSeq - req = &types.QueryLeasesRequest{ + req = &v1beta5.QueryLeasesRequest{ Filters: types.LeaseFilters{ Owner: leaseID.Owner, DSeq: leaseID.DSeq + 1, @@ -867,8 +868,8 @@ func TestGRPCQueryBid(t *testing.T) { bid, _ := createBid(t, suite.TestSuite) var ( - req *types.QueryBidRequest - expBid types.Bid + req *v1beta5.QueryBidRequest + expBid v1beta5.Bid ) testCases := []struct { @@ -879,21 +880,21 @@ func TestGRPCQueryBid(t *testing.T) { { "empty request", func() { - req = &types.QueryBidRequest{} + req = &v1beta5.QueryBidRequest{} }, false, }, { "invalid request", func() { - req = &types.QueryBidRequest{ID: types.BidID{}} + req = &v1beta5.QueryBidRequest{ID: types.BidID{}} }, false, }, { "bid not found", func() { - req = &types.QueryBidRequest{ID: types.BidID{ + req = &v1beta5.QueryBidRequest{ID: types.BidID{ Owner: testutil.AccAddress(t).String(), DSeq: 32, GSeq: 43, @@ -906,7 +907,7 @@ func TestGRPCQueryBid(t *testing.T) { { "success", func() { - req = &types.QueryBidRequest{ID: bid.BidID} + req = &v1beta5.QueryBidRequest{ID: bid.ID} expBid = bid }, true, @@ -942,7 +943,7 @@ func TestGRPCQueryBids(t *testing.T) { bid2, _ := createBid(t, suite.TestSuite) suite.keeper.OnBidLost(suite.ctx, bid2) - var req *types.QueryBidsRequest + var req *v1beta5.QueryBidsRequest testCases := []struct { msg string @@ -952,15 +953,15 @@ func TestGRPCQueryBids(t *testing.T) { { "query bids without any filters and pagination", func() { - req = &types.QueryBidsRequest{} + req = &v1beta5.QueryBidsRequest{} }, 2, }, { "query bids with filters having non existent data", func() { - req = &types.QueryBidsRequest{ - Filters: types.BidFilters{ + req = &v1beta5.QueryBidsRequest{ + Filters: v1beta5.BidFilters{ OSeq: 37, State: types.BidLost.String(), Provider: testutil.AccAddress(t).String(), @@ -971,14 +972,14 @@ func TestGRPCQueryBids(t *testing.T) { { "query bids with state filter", func() { - req = &types.QueryBidsRequest{Filters: types.BidFilters{State: types.BidLost.String()}} + req = &v1beta5.QueryBidsRequest{Filters: v1beta5.BidFilters{State: types.BidLost.String()}} }, 1, }, { "query bids with pagination", func() { - req = &types.QueryBidsRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} + req = &v1beta5.QueryBidsRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} }, 1, }, @@ -1008,7 +1009,7 @@ func TestGRPCQueryLease(t *testing.T) { require.True(t, ok) var ( - req *types.QueryLeaseRequest + req *v1beta5.QueryLeaseRequest expLease types.Lease ) @@ -1020,21 +1021,21 @@ func TestGRPCQueryLease(t *testing.T) { { "empty request", func() { - req = &types.QueryLeaseRequest{} + req = &v1beta5.QueryLeaseRequest{} }, false, }, { "invalid request", func() { - req = &types.QueryLeaseRequest{ID: types.LeaseID{}} + req = &v1beta5.QueryLeaseRequest{ID: types.LeaseID{}} }, false, }, { "lease not found", func() { - req = &types.QueryLeaseRequest{ID: types.LeaseID{ + req = &v1beta5.QueryLeaseRequest{ID: types.LeaseID{ Owner: testutil.AccAddress(t).String(), DSeq: 32, GSeq: 43, @@ -1047,7 +1048,7 @@ func TestGRPCQueryLease(t *testing.T) { { "success", func() { - req = &types.QueryLeaseRequest{ID: lease.LeaseID} + req = &v1beta5.QueryLeaseRequest{ID: lease.ID} expLease = lease }, true, @@ -1086,9 +1087,10 @@ func TestGRPCQueryLeases(t *testing.T) { leaseID2 := createLease(t, suite.TestSuite) lease2, ok := suite.keeper.GetLease(suite.ctx, leaseID2) require.True(t, ok) - suite.keeper.OnLeaseClosed(suite.ctx, lease2, types.LeaseClosed) + err := suite.keeper.OnLeaseClosed(suite.ctx, lease2, types.LeaseClosed) + require.NoError(t, err) - var req *types.QueryLeasesRequest + var req *v1beta5.QueryLeasesRequest testCases := []struct { msg string @@ -1098,14 +1100,14 @@ func TestGRPCQueryLeases(t *testing.T) { { "query leases without any filters and pagination", func() { - req = &types.QueryLeasesRequest{} + req = &v1beta5.QueryLeasesRequest{} }, 2, }, { "query leases with filters having non existent data", func() { - req = &types.QueryLeasesRequest{ + req = &v1beta5.QueryLeasesRequest{ Filters: types.LeaseFilters{ OSeq: 37, State: types.LeaseClosed.String(), @@ -1117,14 +1119,14 @@ func TestGRPCQueryLeases(t *testing.T) { { "query leases with state filter", func() { - req = &types.QueryLeasesRequest{Filters: types.LeaseFilters{State: types.LeaseClosed.String()}} + req = &v1beta5.QueryLeasesRequest{Filters: types.LeaseFilters{State: types.LeaseClosed.String()}} }, 1, }, { "query leases with pagination", func() { - req = &types.QueryLeasesRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} + req = &v1beta5.QueryLeasesRequest{Pagination: &sdkquery.PageRequest{Limit: 1}} }, 1, }, diff --git a/x/market/keeper/keeper.go b/x/market/keeper/keeper.go index 164af4489f..7afc0803a4 100644 --- a/x/market/keeper/keeper.go +++ b/x/market/keeper/keeper.go @@ -4,40 +4,42 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + dtypes "pkg.akt.dev/go/node/deployment/v1" + dtypesBeta "pkg.akt.dev/go/node/deployment/v1beta4" + mv1 "pkg.akt.dev/go/node/market/v1" + types "pkg.akt.dev/go/node/market/v1beta5" - keys "github.com/akash-network/node/x/market/keeper/keys/v1beta4" + keys "pkg.akt.dev/akashd/x/market/keeper/keys/v1beta4" ) -// TODO: use interface for all keepers, queriers type IKeeper interface { NewQuerier() Querier Codec() codec.BinaryCodec - StoreKey() sdk.StoreKey - CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypes.GroupSpec) (types.Order, error) - CreateBid(ctx sdk.Context, oid types.OrderID, provider sdk.AccAddress, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error) - CreateLease(ctx sdk.Context, bid types.Bid) + StoreKey() storetypes.StoreKey + CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error) + CreateBid(ctx sdk.Context, oid mv1.OrderID, provider sdk.AccAddress, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error) + CreateLease(ctx sdk.Context, bid types.Bid) error OnOrderMatched(ctx sdk.Context, order types.Order) OnBidMatched(ctx sdk.Context, bid types.Bid) OnBidLost(ctx sdk.Context, bid types.Bid) - OnBidClosed(ctx sdk.Context, bid types.Bid) - OnOrderClosed(ctx sdk.Context, order types.Order) - OnLeaseClosed(ctx sdk.Context, lease types.Lease, state types.Lease_State) - OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) - GetOrder(ctx sdk.Context, id types.OrderID) (types.Order, bool) - GetBid(ctx sdk.Context, id types.BidID) (types.Bid, bool) - GetLease(ctx sdk.Context, id types.LeaseID) (types.Lease, bool) - LeaseForOrder(ctx sdk.Context, oid types.OrderID) (types.Lease, bool) + OnBidClosed(ctx sdk.Context, bid types.Bid) error + OnOrderClosed(ctx sdk.Context, order types.Order) error + OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.LeaseState) error + OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) error + GetOrder(ctx sdk.Context, id mv1.OrderID) (types.Order, bool) + GetBid(ctx sdk.Context, id mv1.BidID) (types.Bid, bool) + GetLease(ctx sdk.Context, id mv1.LeaseID) (mv1.Lease, bool) + LeaseForOrder(ctx sdk.Context, oid mv1.OrderID) (mv1.Lease, bool) WithOrders(ctx sdk.Context, fn func(types.Order) bool) WithBids(ctx sdk.Context, fn func(types.Bid) bool) - WithLeases(ctx sdk.Context, fn func(types.Lease) bool) + WithLeases(ctx sdk.Context, fn func(mv1.Lease) bool) WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, fn func(types.Order) bool) - WithBidsForOrder(ctx sdk.Context, id types.OrderID, fn func(types.Bid) bool) - BidCountForOrder(ctx sdk.Context, id types.OrderID) uint32 + WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, fn func(types.Bid) bool) + BidCountForOrder(ctx sdk.Context, id mv1.OrderID) uint32 GetParams(ctx sdk.Context) (params types.Params) SetParams(ctx sdk.Context, params types.Params) } @@ -45,13 +47,13 @@ type IKeeper interface { // Keeper of the market store type Keeper struct { cdc codec.BinaryCodec - skey sdk.StoreKey + skey storetypes.StoreKey pspace paramtypes.Subspace ekeeper EscrowKeeper } // NewKeeper creates and returns an instance for Market keeper -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, pspace paramtypes.Subspace, ekeeper EscrowKeeper) IKeeper { +func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey, pspace paramtypes.Subspace, ekeeper EscrowKeeper) IKeeper { if !pspace.HasKeyTable() { pspace = pspace.WithKeyTable(types.ParamKeyTable()) } @@ -74,12 +76,12 @@ func (k Keeper) Codec() codec.BinaryCodec { } // StoreKey returns store key -func (k Keeper) StoreKey() sdk.StoreKey { +func (k Keeper) StoreKey() storetypes.StoreKey { return k.skey } // CreateOrder creates a new order with given group id and specifications. It returns created order -func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypes.GroupSpec) (types.Order, error) { +func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error) { store := ctx.KVStore(k.skey) oseq := uint32(1) @@ -98,13 +100,13 @@ func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypes.Gro } order := types.Order{ - OrderID: types.MakeOrderID(gid, oseq), + ID: mv1.MakeOrderID(gid, oseq), Spec: spec, - State: types.OrderOpen, + State: mv1.OrderOpen, CreatedAt: ctx.BlockHeight(), } - key := keys.OrderKey(order.ID()) + key := keys.OrderKey(order.ID) if store.Has(key) { return types.Order{}, types.ErrOrderExists @@ -112,27 +114,29 @@ func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypes.Gro store.Set(key, k.cdc.MustMarshal(&order)) - ctx.Logger().Info("created order", "order", order.ID()) - ctx.EventManager().EmitEvent( - types.NewEventOrderCreated(order.ID()). - ToSDKEvent(), + err = ctx.EventManager().EmitTypedEvent( + &mv1.EventOrderCreated{ID: order.ID}, ) + if err != nil { + return types.Order{}, err + } + return order, nil } // CreateBid creates a bid for a order with given orderID, price for bid and provider -func (k Keeper) CreateBid(ctx sdk.Context, oid types.OrderID, provider sdk.AccAddress, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error) { +func (k Keeper) CreateBid(ctx sdk.Context, oid mv1.OrderID, provider sdk.AccAddress, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error) { store := ctx.KVStore(k.skey) bid := types.Bid{ - BidID: types.MakeBidID(oid, provider), - State: types.BidOpen, + ID: mv1.MakeBidID(oid, provider), + State: mv1.BidOpen, Price: price, CreatedAt: ctx.BlockHeight(), ResourcesOffer: roffer, } - key := keys.BidKey(bid.ID()) + key := keys.BidKey(bid.ID) if store.Has(key) { return types.Bid{}, types.ErrBidExists @@ -140,115 +144,160 @@ func (k Keeper) CreateBid(ctx sdk.Context, oid types.OrderID, provider sdk.AccAd store.Set(key, k.cdc.MustMarshal(&bid)) - ctx.EventManager().EmitEvent( - types.NewEventBidCreated(bid.ID(), price). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &mv1.EventBidCreated{ + ID: bid.ID, + Price: price, + }, ) + if err != nil { + return types.Bid{}, err + } return bid, nil } // CreateLease creates lease for bid with given bidID. // Should only be called by the EndBlock handler or unit tests. -func (k Keeper) CreateLease(ctx sdk.Context, bid types.Bid) { +func (k Keeper) CreateLease(ctx sdk.Context, bid types.Bid) error { store := ctx.KVStore(k.skey) - lease := types.Lease{ - LeaseID: types.LeaseID(bid.ID()), - State: types.LeaseActive, + lease := mv1.Lease{ + ID: mv1.LeaseID(bid.ID), + State: mv1.LeaseActive, Price: bid.Price, CreatedAt: ctx.BlockHeight(), } // create (active) lease in store - key := keys.LeaseKey(lease.ID()) + key := keys.LeaseKey(lease.ID) store.Set(key, k.cdc.MustMarshal(&lease)) - ctx.Logger().Info("created lease", "lease", lease.ID()) - ctx.EventManager().EmitEvent( - types.NewEventLeaseCreated(lease.ID(), lease.Price). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &mv1.EventLeaseCreated{ + ID: lease.ID, + Price: lease.Price, + }, ) + if err != nil { + return err + } + + return nil } // OnOrderMatched updates order state to matched func (k Keeper) OnOrderMatched(ctx sdk.Context, order types.Order) { - order.State = types.OrderActive + order.State = mv1.OrderActive k.updateOrder(ctx, order) } -// OnBidActive updates bid state to matched +// OnBidMatched updates bid state to matched func (k Keeper) OnBidMatched(ctx sdk.Context, bid types.Bid) { - bid.State = types.BidActive + bid.State = mv1.BidActive k.updateBid(ctx, bid) } // OnBidLost updates bid state to bid lost func (k Keeper) OnBidLost(ctx sdk.Context, bid types.Bid) { - bid.State = types.BidLost + bid.State = mv1.BidLost k.updateBid(ctx, bid) } // OnBidClosed updates bid state to closed -func (k Keeper) OnBidClosed(ctx sdk.Context, bid types.Bid) { +func (k Keeper) OnBidClosed(ctx sdk.Context, bid types.Bid) error { switch bid.State { - case types.BidClosed, types.BidLost: - return + case mv1.BidClosed, mv1.BidLost: + return nil } - bid.State = types.BidClosed + + bid.State = mv1.BidClosed k.updateBid(ctx, bid) - k.ekeeper.AccountClose(ctx, types.EscrowAccountForBid(bid.ID())) + _ = k.ekeeper.AccountClose(ctx, types.EscrowAccountForBid(bid.ID)) - ctx.EventManager().EmitEvent( - types.NewEventBidClosed(bid.ID(), bid.Price). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &mv1.EventBidClosed{ + ID: bid.ID, + }, ) + if err != nil { + return err + } + + return nil } // OnOrderClosed updates order state to closed -func (k Keeper) OnOrderClosed(ctx sdk.Context, order types.Order) { - if order.State == types.OrderClosed { - return +func (k Keeper) OnOrderClosed(ctx sdk.Context, order types.Order) error { + if order.State == mv1.OrderClosed { + return nil } - order.State = types.OrderClosed + order.State = mv1.OrderClosed k.updateOrder(ctx, order) - ctx.EventManager().EmitEvent( - types.NewEventOrderClosed(order.ID()). - ToSDKEvent(), + + err := ctx.EventManager().EmitTypedEvent( + &mv1.EventOrderClosed{ + ID: order.ID, + }, ) + if err != nil { + return err + } + + return nil } // OnLeaseClosed updates lease state to closed -func (k Keeper) OnLeaseClosed(ctx sdk.Context, lease types.Lease, state types.Lease_State) { +func (k Keeper) OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.LeaseState) error { switch lease.State { - case types.LeaseClosed, types.LeaseInsufficientFunds: - return + case mv1.LeaseClosed, mv1.LeaseInsufficientFunds: + return nil } + lease.State = state lease.ClosedOn = ctx.BlockHeight() k.updateLease(ctx, lease) - ctx.EventManager().EmitEvent( - types.NewEventLeaseClosed(lease.ID(), lease.Price). - ToSDKEvent(), + err := ctx.EventManager().EmitTypedEvent( + &mv1.EventLeaseClosed{ + ID: lease.ID, + }, ) + if err != nil { + return err + } + + return nil } // OnGroupClosed updates state of all orders, bids and leases in group to closed -func (k Keeper) OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) { +func (k Keeper) OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) error { + var err error k.WithOrdersForGroup(ctx, id, func(order types.Order) bool { - k.OnOrderClosed(ctx, order) - k.WithBidsForOrder(ctx, order.ID(), func(bid types.Bid) bool { - k.OnBidClosed(ctx, bid) - if lease, ok := k.GetLease(ctx, types.LeaseID(bid.ID())); ok { - k.OnLeaseClosed(ctx, lease, types.LeaseClosed) - - if err := k.ekeeper.PaymentClose(ctx, - dtypes.EscrowAccountForDeployment(id.DeploymentID()), - types.EscrowPaymentForLease(lease.ID())); err != nil { - ctx.Logger().With("err", err).Info("error closing payment") + err = k.OnOrderClosed(ctx, order) + if err != nil { + return false + } + + k.WithBidsForOrder(ctx, order.ID, func(bid types.Bid) bool { + err = k.OnBidClosed(ctx, bid) + if err != nil { + return false + } + + if lease, ok := k.GetLease(ctx, mv1.LeaseID(bid.ID)); ok { + err = k.OnLeaseClosed(ctx, lease, mv1.LeaseClosed) + if err != nil { + return false + } + + err = k.ekeeper.PaymentClose(ctx, + dtypesBeta.EscrowAccountForDeployment(id.DeploymentID()), + types.EscrowPaymentForLease(lease.ID)) + if err != nil { + return false } } @@ -256,10 +305,16 @@ func (k Keeper) OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) { }) return false }) + + if err != nil { + return err + } + + return nil } // GetOrder returns order with given orderID from market store -func (k Keeper) GetOrder(ctx sdk.Context, id types.OrderID) (types.Order, bool) { +func (k Keeper) GetOrder(ctx sdk.Context, id mv1.OrderID) (types.Order, bool) { store := ctx.KVStore(k.skey) key := keys.OrderKey(id) if !store.Has(key) { @@ -274,7 +329,7 @@ func (k Keeper) GetOrder(ctx sdk.Context, id types.OrderID) (types.Order, bool) } // GetBid returns bid with given bidID from market store -func (k Keeper) GetBid(ctx sdk.Context, id types.BidID) (types.Bid, bool) { +func (k Keeper) GetBid(ctx sdk.Context, id mv1.BidID) (types.Bid, bool) { store := ctx.KVStore(k.skey) key := keys.BidKey(id) if !store.Has(key) { @@ -289,35 +344,33 @@ func (k Keeper) GetBid(ctx sdk.Context, id types.BidID) (types.Bid, bool) { } // GetLease returns lease with given leaseID from market store -func (k Keeper) GetLease(ctx sdk.Context, id types.LeaseID) (types.Lease, bool) { +func (k Keeper) GetLease(ctx sdk.Context, id mv1.LeaseID) (mv1.Lease, bool) { store := ctx.KVStore(k.skey) key := keys.LeaseKey(id) if !store.Has(key) { - return types.Lease{}, false + return mv1.Lease{}, false } buf := store.Get(key) - var val types.Lease + var val mv1.Lease k.cdc.MustUnmarshal(buf, &val) return val, true } // LeaseForOrder returns lease for order with given ID and lease found status -func (k Keeper) LeaseForOrder(ctx sdk.Context, oid types.OrderID) (types.Lease, bool) { - var ( - value types.Lease - found bool - ) +func (k Keeper) LeaseForOrder(ctx sdk.Context, oid mv1.OrderID) (mv1.Lease, bool) { + var value mv1.Lease + var found bool k.WithBidsForOrder(ctx, oid, func(item types.Bid) bool { - if !item.ID().OrderID().Equals(oid) { + if !item.ID.OrderID().Equals(oid) { return false } - if item.State != types.BidActive { + if item.State != mv1.BidActive { return false } - value, found = k.GetLease(ctx, types.LeaseID(item.ID())) + value, found = k.GetLease(ctx, mv1.LeaseID(item.ID)) return true }) @@ -328,7 +381,11 @@ func (k Keeper) LeaseForOrder(ctx sdk.Context, oid types.OrderID) (types.Lease, func (k Keeper) WithOrders(ctx sdk.Context, fn func(types.Order) bool) { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, types.OrderPrefix()) - defer iter.Close() + + defer func() { + _ = iter.Close() + }() + for ; iter.Valid(); iter.Next() { var val types.Order k.cdc.MustUnmarshal(iter.Value(), &val) @@ -342,7 +399,11 @@ func (k Keeper) WithOrders(ctx sdk.Context, fn func(types.Order) bool) { func (k Keeper) WithBids(ctx sdk.Context, fn func(types.Bid) bool) { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, types.BidPrefix()) - defer iter.Close() + + defer func() { + _ = iter.Close() + }() + for ; iter.Valid(); iter.Next() { var val types.Bid k.cdc.MustUnmarshal(iter.Value(), &val) @@ -353,12 +414,15 @@ func (k Keeper) WithBids(ctx sdk.Context, fn func(types.Bid) bool) { } // WithLeases iterates all leases in market -func (k Keeper) WithLeases(ctx sdk.Context, fn func(types.Lease) bool) { +func (k Keeper) WithLeases(ctx sdk.Context, fn func(mv1.Lease) bool) { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, types.LeasePrefix()) - defer iter.Close() + defer func() { + _ = iter.Close() + }() + for ; iter.Valid(); iter.Next() { - var val types.Lease + var val mv1.Lease k.cdc.MustUnmarshal(iter.Value(), &val) if stop := fn(val); stop { break @@ -370,7 +434,11 @@ func (k Keeper) WithLeases(ctx sdk.Context, fn func(types.Lease) bool) { func (k Keeper) WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, fn func(types.Order) bool) { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, keys.OrdersForGroupPrefix(id)) - defer iter.Close() + + defer func() { + _ = iter.Close() + }() + for ; iter.Valid(); iter.Next() { var val types.Order k.cdc.MustUnmarshal(iter.Value(), &val) @@ -381,11 +449,14 @@ func (k Keeper) WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, fn func(t } // WithBidsForOrder iterates all bids of a order in market with given OrderID -func (k Keeper) WithBidsForOrder(ctx sdk.Context, id types.OrderID, fn func(types.Bid) bool) { +func (k Keeper) WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, fn func(types.Bid) bool) { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, keys.BidsForOrderPrefix(id)) - defer iter.Close() + defer func() { + _ = iter.Close() + }() + for ; iter.Valid(); iter.Next() { var val types.Bid k.cdc.MustUnmarshal(iter.Value(), &val) @@ -395,10 +466,13 @@ func (k Keeper) WithBidsForOrder(ctx sdk.Context, id types.OrderID, fn func(type } } -func (k Keeper) BidCountForOrder(ctx sdk.Context, id types.OrderID) uint32 { +func (k Keeper) BidCountForOrder(ctx sdk.Context, id mv1.OrderID) uint32 { store := ctx.KVStore(k.skey) iter := sdk.KVStorePrefixIterator(store, keys.BidsForOrderPrefix(id)) - defer iter.Close() + defer func() { + _ = iter.Close() + }() + count := uint32(0) for ; iter.Valid(); iter.Next() { count++ @@ -419,18 +493,18 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { func (k Keeper) updateOrder(ctx sdk.Context, order types.Order) { store := ctx.KVStore(k.skey) - key := keys.OrderKey(order.ID()) + key := keys.OrderKey(order.ID) store.Set(key, k.cdc.MustMarshal(&order)) } func (k Keeper) updateBid(ctx sdk.Context, bid types.Bid) { store := ctx.KVStore(k.skey) - key := keys.BidKey(bid.ID()) + key := keys.BidKey(bid.ID) store.Set(key, k.cdc.MustMarshal(&bid)) } -func (k Keeper) updateLease(ctx sdk.Context, lease types.Lease) { +func (k Keeper) updateLease(ctx sdk.Context, lease mv1.Lease) { store := ctx.KVStore(k.skey) - key := keys.LeaseKey(lease.ID()) + key := keys.LeaseKey(lease.ID) store.Set(key, k.cdc.MustMarshal(&lease)) } diff --git a/x/market/keeper/keeper_test.go b/x/market/keeper/keeper_test.go index 54d4dac40b..374da57768 100644 --- a/x/market/keeper/keeper_test.go +++ b/x/market/keeper/keeper_test.go @@ -8,12 +8,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + "pkg.akt.dev/go/node/market/v1" + types "pkg.akt.dev/go/node/market/v1beta5" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/market/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/market/keeper" ) func Test_CreateOrder(t *testing.T) { @@ -21,14 +22,14 @@ func Test_CreateOrder(t *testing.T) { order, gspec := createOrder(t, ctx, keeper) // assert one active for group - _, err := keeper.CreateOrder(ctx, order.ID().GroupID(), gspec) + _, err := keeper.CreateOrder(ctx, order.ID.GroupID(), gspec) require.Error(t, err) } func Test_GetOrder(t *testing.T) { ctx, keeper, _ := setupKeeper(t) order, _ := createOrder(t, ctx, keeper) - result, ok := keeper.GetOrder(ctx, order.ID()) + result, ok := keeper.GetOrder(ctx, order.ID) require.True(t, ok) require.Equal(t, order, result) @@ -45,7 +46,7 @@ func Test_WithOrders(t *testing.T) { count := 0 keeper.WithOrders(ctx, func(result types.Order) bool { - if assert.Equal(t, order.ID(), result.ID()) { + if assert.Equal(t, order.ID, result.ID) { count++ } return false @@ -62,8 +63,8 @@ func Test_WithOrdersForGroup(t *testing.T) { createOrder(t, ctx, keeper) count := 0 - keeper.WithOrdersForGroup(ctx, order.ID().GroupID(), func(result types.Order) bool { - if assert.Equal(t, order.ID(), result.ID()) { + keeper.WithOrdersForGroup(ctx, order.ID.GroupID(), func(result types.Order) bool { + if assert.Equal(t, order.ID, result.ID) { count++ } return false @@ -83,7 +84,7 @@ func Test_GetBid(t *testing.T) { keeper := suite.MarketKeeper() - result, ok := keeper.GetBid(ctx, bid.ID()) + result, ok := keeper.GetBid(ctx, bid.ID) require.True(t, ok) assert.Equal(t, bid, result) @@ -99,7 +100,7 @@ func Test_WithBids(t *testing.T) { bid, _ := createBid(t, suite) count := 0 keeper.WithBids(ctx, func(result types.Bid) bool { - if assert.Equal(t, bid.ID(), result.ID()) { + if assert.Equal(t, bid.ID, result.ID) { count++ } return false @@ -116,8 +117,8 @@ func Test_WithBidsForOrder(t *testing.T) { createBid(t, suite) count := 0 - keeper.WithBidsForOrder(ctx, bid.ID().OrderID(), func(result types.Bid) bool { - if assert.Equal(t, bid.ID(), result.ID()) { + keeper.WithBidsForOrder(ctx, bid.ID.OrderID(), func(result types.Bid) bool { + if assert.Equal(t, bid.ID, result.ID) { count++ } return false @@ -131,7 +132,7 @@ func Test_GetLease(t *testing.T) { lease, ok := keeper.GetLease(ctx, id) assert.True(t, ok) - assert.Equal(t, id, lease.ID()) + assert.Equal(t, id, lease.ID) // non-existent { @@ -145,8 +146,8 @@ func Test_WithLeases(t *testing.T) { id := createLease(t, suite) count := 0 - keeper.WithLeases(ctx, func(result types.Lease) bool { - if assert.Equal(t, id, result.ID()) { + keeper.WithLeases(ctx, func(result v1.Lease) bool { + if assert.Equal(t, id, result.ID) { count++ } return false @@ -165,12 +166,12 @@ func Test_LeaseForOrder(t *testing.T) { result, ok := keeper.LeaseForOrder(ctx, id.OrderID()) assert.True(t, ok) - assert.Equal(t, id, result.ID()) + assert.Equal(t, id, result.ID) // no match { bid, _ := createBid(t, suite) - _, ok := keeper.LeaseForOrder(ctx, bid.ID().OrderID()) + _, ok := keeper.LeaseForOrder(ctx, bid.ID.OrderID()) assert.False(t, ok) } } @@ -181,7 +182,7 @@ func Test_OnOrderMatched(t *testing.T) { result, ok := keeper.GetOrder(ctx, id.OrderID()) require.True(t, ok) - assert.Equal(t, types.OrderActive, result.State) + assert.Equal(t, v1.OrderActive, result.State) } func Test_OnBidMatched(t *testing.T) { @@ -190,7 +191,7 @@ func Test_OnBidMatched(t *testing.T) { result, ok := keeper.GetBid(ctx, id.BidID()) require.True(t, ok) - assert.Equal(t, types.BidActive, result.State) + assert.Equal(t, v1.BidActive, result.State) } func Test_OnBidLost(t *testing.T) { @@ -198,20 +199,21 @@ func Test_OnBidLost(t *testing.T) { bid, _ := createBid(t, suite) keeper.OnBidLost(ctx, bid) - result, ok := keeper.GetBid(ctx, bid.ID()) + result, ok := keeper.GetBid(ctx, bid.ID) require.True(t, ok) - assert.Equal(t, types.BidLost, result.State) + assert.Equal(t, v1.BidLost, result.State) } func Test_OnOrderClosed(t *testing.T) { ctx, keeper, _ := setupKeeper(t) order, _ := createOrder(t, ctx, keeper) - keeper.OnOrderClosed(ctx, order) + err := keeper.OnOrderClosed(ctx, order) + require.NoError(t, err) - result, ok := keeper.GetOrder(ctx, order.ID()) + result, ok := keeper.GetOrder(ctx, order.ID) require.True(t, ok) - assert.Equal(t, types.OrderClosed, result.State) + assert.Equal(t, v1.OrderClosed, result.State) } func Test_OnLeaseClosed(t *testing.T) { @@ -226,12 +228,13 @@ func Test_OnLeaseClosed(t *testing.T) { const testBlockHeight = 1337 suite.SetBlockHeight(testBlockHeight) - require.Equal(t, types.LeaseActive, lease.State) - keeper.OnLeaseClosed(suite.Context(), lease, types.LeaseClosed) + require.Equal(t, v1.LeaseActive, lease.State) + err := keeper.OnLeaseClosed(suite.Context(), lease, v1.LeaseClosed) + require.NoError(t, err) result, ok := keeper.GetLease(suite.Context(), id) require.True(t, ok) - assert.Equal(t, types.LeaseClosed, result.State) + assert.Equal(t, v1.LeaseClosed, result.State) assert.Equal(t, int64(testBlockHeight), result.ClosedOn) } @@ -245,19 +248,19 @@ func Test_OnGroupClosed(t *testing.T) { lease, ok := keeper.GetLease(suite.Context(), id) require.True(t, ok) - assert.Equal(t, types.LeaseClosed, lease.State) + assert.Equal(t, v1.LeaseClosed, lease.State) assert.Equal(t, int64(testBlockHeight), lease.ClosedOn) bid, ok := keeper.GetBid(suite.Context(), id.BidID()) require.True(t, ok) - assert.Equal(t, types.BidClosed, bid.State) + assert.Equal(t, v1.BidClosed, bid.State) order, ok := keeper.GetOrder(suite.Context(), id.OrderID()) require.True(t, ok) - assert.Equal(t, types.OrderClosed, order.State) + assert.Equal(t, v1.OrderClosed, order.State) } -func createLease(t testing.TB, suite *state.TestSuite) types.LeaseID { +func createLease(t testing.TB, suite *state.TestSuite) v1.LeaseID { t.Helper() ctx := suite.Context() bid, order := createBid(t, suite) @@ -266,7 +269,7 @@ func createLease(t testing.TB, suite *state.TestSuite) types.LeaseID { keeper.OnBidMatched(ctx, bid) keeper.OnOrderMatched(ctx, order) - owner, err := sdk.AccAddressFromBech32(bid.ID().Owner) + owner, err := sdk.AccAddressFromBech32(bid.ID.Owner) require.NoError(t, err) defaultDeposit, err := dtypes.DefaultParams().MinDepositFor("uakt") @@ -274,26 +277,26 @@ func createLease(t testing.TB, suite *state.TestSuite) types.LeaseID { err = suite.EscrowKeeper().AccountCreate( ctx, - dtypes.EscrowAccountForDeployment(bid.ID().DeploymentID()), + dtypes.EscrowAccountForDeployment(bid.ID.DeploymentID()), owner, owner, defaultDeposit, ) require.NoError(t, err) - provider, err := sdk.AccAddressFromBech32(bid.ID().Provider) + provider, err := sdk.AccAddressFromBech32(bid.ID.Provider) require.NoError(t, err) err = suite.EscrowKeeper().PaymentCreate( ctx, - dtypes.EscrowAccountForDeployment(bid.ID().DeploymentID()), - types.EscrowPaymentForLease(bid.ID().LeaseID()), + dtypes.EscrowAccountForDeployment(bid.ID.DeploymentID()), + types.EscrowPaymentForLease(bid.ID.LeaseID()), provider, bid.Price, ) require.NoError(t, err) - return bid.ID().LeaseID() + return bid.ID.LeaseID() } func createBid(t testing.TB, suite *state.TestSuite) (types.Bid, types.Order) { @@ -304,15 +307,15 @@ func createBid(t testing.TB, suite *state.TestSuite) (types.Bid, types.Order) { price := testutil.AkashDecCoinRandom(t) roffer := types.ResourceOfferFromRU(gspec.Resources) - bid, err := suite.MarketKeeper().CreateBid(ctx, order.ID(), provider, price, roffer) + bid, err := suite.MarketKeeper().CreateBid(ctx, order.ID, provider, price, roffer) require.NoError(t, err) - assert.Equal(t, order.ID(), bid.ID().OrderID()) + assert.Equal(t, order.ID, bid.ID.OrderID()) assert.Equal(t, price, bid.Price) - assert.Equal(t, provider.String(), bid.ID().Provider) + assert.Equal(t, provider.String(), bid.ID.Provider) err = suite.EscrowKeeper().AccountCreate( ctx, - types.EscrowAccountForBid(bid.ID()), + types.EscrowAccountForBid(bid.ID), provider, provider, types.DefaultBidMinDeposit, @@ -326,12 +329,12 @@ func createOrder(t testing.TB, ctx sdk.Context, keeper keeper.IKeeper) (types.Or t.Helper() group := testutil.DeploymentGroup(t, testutil.DeploymentID(t), 0) - order, err := keeper.CreateOrder(ctx, group.ID(), group.GroupSpec) + order, err := keeper.CreateOrder(ctx, group.ID, group.GroupSpec) require.NoError(t, err) - require.Equal(t, group.ID(), order.ID().GroupID()) - require.Equal(t, uint32(1), order.ID().OSeq) - require.Equal(t, types.OrderOpen, order.State) + require.Equal(t, group.ID, order.ID.GroupID()) + require.Equal(t, uint32(1), order.ID.OSeq) + require.Equal(t, v1.OrderOpen, order.State) return order, group.GroupSpec } diff --git a/x/market/keeper/keys/v1beta4/key.go b/x/market/keeper/keys/key.go similarity index 84% rename from x/market/keeper/keys/v1beta4/key.go rename to x/market/keeper/keys/key.go index 6282c95dbb..dcf4718444 100644 --- a/x/market/keeper/keys/v1beta4/key.go +++ b/x/market/keeper/keys/key.go @@ -1,4 +1,4 @@ -package v1beta4 +package keys import ( "bytes" @@ -6,9 +6,10 @@ import ( "github.com/cosmos/cosmos-sdk/types/address" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - "github.com/akash-network/akash-api/go/sdkutil" + dtypes "pkg.akt.dev/go/node/deployment/v1" + types "pkg.akt.dev/go/node/market/v1" + mv1beta "pkg.akt.dev/go/node/market/v1beta5" + "pkg.akt.dev/go/sdkutil" ) func filterToPrefix(prefix []byte, owner string, dseq uint64, gseq, oseq uint32, provider string) ([]byte, error) { @@ -55,20 +56,20 @@ func filterToPrefix(prefix []byte, owner string, dseq uint64, gseq, oseq uint32, } func OrderPrefixFromFilter(f types.OrderFilters) ([]byte, error) { - return filterToPrefix(types.OrderPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, "") + return filterToPrefix(mv1beta.OrderPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, "") } func LeasePrefixFromFilter(f types.LeaseFilters) ([]byte, bool, error) { - prefix, err := filterToPrefix(types.LeasePrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) + prefix, err := filterToPrefix(mv1beta.LeasePrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) return prefix, false, err } func BidPrefixFromFilter(f types.BidFilters) ([]byte, error) { - return filterToPrefix(types.BidPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) + return filterToPrefix(mv1beta.BidPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) } func OrderKey(id types.OrderID) []byte { - buf := bytes.NewBuffer(types.OrderPrefix()) + buf := bytes.NewBuffer(mv1beta.OrderPrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) @@ -83,7 +84,7 @@ func OrderKey(id types.OrderID) []byte { } func BidKey(id types.BidID) []byte { - buf := bytes.NewBuffer(types.BidPrefix()) + buf := bytes.NewBuffer(mv1beta.BidPrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) @@ -99,7 +100,7 @@ func BidKey(id types.BidID) []byte { } func LeaseKey(id types.LeaseID) []byte { - buf := bytes.NewBuffer(types.LeasePrefix()) + buf := bytes.NewBuffer(mv1beta.LeasePrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) @@ -115,7 +116,7 @@ func LeaseKey(id types.LeaseID) []byte { } func SecondaryLeaseKeyByProvider(id types.LeaseID) []byte { - buf := bytes.NewBuffer(types.SecondaryLeasePrefix()) + buf := bytes.NewBuffer(mv1beta.SecondaryLeasePrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Provider))) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { @@ -137,7 +138,7 @@ func SecondaryKeysForLease(id types.LeaseID) [][]byte { } func OrdersForGroupPrefix(id dtypes.GroupID) []byte { - buf := bytes.NewBuffer(types.OrderPrefix()) + buf := bytes.NewBuffer(mv1beta.OrderPrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) @@ -149,7 +150,7 @@ func OrdersForGroupPrefix(id dtypes.GroupID) []byte { } func BidsForOrderPrefix(id types.OrderID) []byte { - buf := bytes.NewBuffer(types.BidPrefix()) + buf := bytes.NewBuffer(mv1beta.BidPrefix()) buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { panic(err) diff --git a/x/market/keeper/keys/v1beta4/key_test.go b/x/market/keeper/keys/key_test.go similarity index 59% rename from x/market/keeper/keys/v1beta4/key_test.go rename to x/market/keeper/keys/key_test.go index 08752aef99..cacbbe6000 100644 --- a/x/market/keeper/keys/v1beta4/key_test.go +++ b/x/market/keeper/keys/key_test.go @@ -1,35 +1,36 @@ -package v1beta4_test +package keys_test import ( "testing" "github.com/stretchr/testify/require" - _ "github.com/akash-network/node/testutil" + _ "pkg.akt.dev/akashd/testutil" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + "pkg.akt.dev/go/node/market/v1" + "pkg.akt.dev/go/node/market/v1beta5" - keys "github.com/akash-network/node/x/market/keeper/keys/v1beta4" + "pkg.akt.dev/akashd/x/market/keeper/keys" ) func TestKeysAndSecondaryKeysFilter(t *testing.T) { - filter := types.LeaseFilters{ + filter := v1.LeaseFilters{ Owner: "akash104fq56d9attl4m709h7mgx9lwqklnh05fhy5nu", DSeq: 1, GSeq: 2, OSeq: 3, Provider: "akash1vlaa09ytnl0hvu04wgs0d6zw5n6anjc3allk49", - State: types.LeaseClosed.String(), + State: v1.LeaseClosed.String(), } prefix, isSecondary, err := keys.LeasePrefixFromFilter(filter) require.NoError(t, err) require.False(t, isSecondary) - require.Equal(t, types.LeasePrefix(), prefix[0:2]) + require.Equal(t, v1beta5.LeasePrefix(), prefix[0:2]) filter.Owner = "" prefix, isSecondary, err = keys.LeasePrefixFromFilter(filter) require.NoError(t, err) require.False(t, isSecondary) - require.Equal(t, types.LeasePrefix(), prefix[0:2]) + require.Equal(t, v1beta5.LeasePrefix(), prefix[0:2]) } diff --git a/x/market/keeper/keys/v1beta1/key.go b/x/market/keeper/keys/v1beta1/key.go deleted file mode 100644 index e76fdbab41..0000000000 --- a/x/market/keeper/keys/v1beta1/key.go +++ /dev/null @@ -1,92 +0,0 @@ -package v1beta1 - -import ( - "bytes" - "encoding/binary" - - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta1" - types "github.com/akash-network/akash-api/go/node/market/v1beta1" -) - -var ( - orderPrefix = []byte{0x01, 0x00} - bidPrefix = []byte{0x02, 0x00} - leasePrefix = []byte{0x03, 0x00} // nolint: unused -) - -// nolint: unused -func orderKey(id types.OrderID) []byte { - buf := bytes.NewBuffer(orderPrefix) - buf.Write([]byte(id.Owner)) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -// nolint: unused -func bidKey(id types.BidID) []byte { - buf := bytes.NewBuffer(bidPrefix) - buf.Write([]byte(id.Owner)) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - buf.Write([]byte(id.Provider)) - return buf.Bytes() -} - -// nolint: unused -func leaseKey(id types.LeaseID) []byte { - buf := bytes.NewBuffer(leasePrefix) - buf.Write([]byte(id.Owner)) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - buf.Write([]byte(id.Provider)) - return buf.Bytes() -} - -func OrdersForGroupPrefix(id dtypes.GroupID) []byte { - buf := bytes.NewBuffer(orderPrefix) - buf.Write([]byte(id.Owner)) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -func BidsForOrderPrefix(id types.OrderID) []byte { - buf := bytes.NewBuffer(bidPrefix) - buf.Write([]byte(id.Owner)) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} diff --git a/x/market/keeper/keys/v1beta2/key.go b/x/market/keeper/keys/v1beta2/key.go deleted file mode 100644 index 991206c6e5..0000000000 --- a/x/market/keeper/keys/v1beta2/key.go +++ /dev/null @@ -1,164 +0,0 @@ -package v1beta2 - -import ( - "bytes" - "encoding/binary" - - "github.com/cosmos/cosmos-sdk/types/address" - - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta2" - types "github.com/akash-network/akash-api/go/node/market/v1beta2" - "github.com/akash-network/akash-api/go/sdkutil" -) - -func filterToPrefix(prefix []byte, owner string, dseq uint64, gseq, oseq uint32, provider string) ([]byte, error) { - buf := bytes.NewBuffer(prefix) - - if len(owner) == 0 { - return buf.Bytes(), nil - } - - if _, err := buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(owner))); err != nil { - return nil, err - } - - if dseq == 0 { - return buf.Bytes(), nil - } - if err := binary.Write(buf, binary.BigEndian, dseq); err != nil { - return nil, err - } - - if gseq == 0 { - return buf.Bytes(), nil - } - if err := binary.Write(buf, binary.BigEndian, gseq); err != nil { - return nil, err - } - - if oseq == 0 { - return buf.Bytes(), nil - } - if err := binary.Write(buf, binary.BigEndian, oseq); err != nil { - return nil, err - } - - if len(provider) == 0 { - return buf.Bytes(), nil - } - - if _, err := buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(provider))); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -func OrderPrefixFromFilter(f types.OrderFilters) ([]byte, error) { - return filterToPrefix(types.OrderPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, "") -} - -func LeasePrefixFromFilter(f types.LeaseFilters) ([]byte, bool, error) { - prefix, err := filterToPrefix(types.LeasePrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) - return prefix, false, err -} - -func BidPrefixFromFilter(f types.BidFilters) ([]byte, error) { - return filterToPrefix(types.BidPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) -} - -func OrderKey(id types.OrderID) []byte { - buf := bytes.NewBuffer(types.OrderPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -func BidKey(id types.BidID) []byte { - buf := bytes.NewBuffer(types.BidPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Provider))) - return buf.Bytes() -} - -func LeaseKey(id types.LeaseID) []byte { - buf := bytes.NewBuffer(types.LeasePrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Provider))) - return buf.Bytes() -} - -func secondaryLeaseKeyByProvider(id types.LeaseID) []byte { - buf := bytes.NewBuffer(types.SecondaryLeasePrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Provider))) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -func SecondaryKeysForLease(id types.LeaseID) [][]byte { - return [][]byte{ - secondaryLeaseKeyByProvider(id), - } -} - -func OrdersForGroupPrefix(id dtypes.GroupID) []byte { - buf := bytes.NewBuffer(types.OrderPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -func BidsForOrderPrefix(id types.OrderID) []byte { - buf := bytes.NewBuffer(types.BidPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} diff --git a/x/market/keeper/keys/v1beta2/key_test.go b/x/market/keeper/keys/v1beta2/key_test.go deleted file mode 100644 index 82636a734f..0000000000 --- a/x/market/keeper/keys/v1beta2/key_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package v1beta2_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - types "github.com/akash-network/akash-api/go/node/market/v1beta2" - - _ "github.com/akash-network/node/testutil" - keys "github.com/akash-network/node/x/market/keeper/keys/v1beta2" -) - -func TestKeysAndSecondaryKeysFilter(t *testing.T) { - filter := types.LeaseFilters{ - Owner: "akash104fq56d9attl4m709h7mgx9lwqklnh05fhy5nu", - DSeq: 1, - GSeq: 2, - OSeq: 3, - Provider: "akash1vlaa09ytnl0hvu04wgs0d6zw5n6anjc3allk49", - State: types.LeaseClosed.String(), - } - - prefix, isSecondary, err := keys.LeasePrefixFromFilter(filter) - require.NoError(t, err) - require.False(t, isSecondary) - require.Equal(t, types.LeasePrefix(), prefix[0:2]) - - filter.Owner = "" - prefix, isSecondary, err = keys.LeasePrefixFromFilter(filter) - require.NoError(t, err) - require.False(t, isSecondary) - require.Equal(t, types.LeasePrefix(), prefix[0:2]) -} diff --git a/x/market/keeper/keys/v1beta3/key.go b/x/market/keeper/keys/v1beta3/key.go deleted file mode 100644 index 78ace686be..0000000000 --- a/x/market/keeper/keys/v1beta3/key.go +++ /dev/null @@ -1,164 +0,0 @@ -package v1beta3 - -import ( - "bytes" - "encoding/binary" - - "github.com/cosmos/cosmos-sdk/types/address" - - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta3" - "github.com/akash-network/akash-api/go/sdkutil" -) - -func filterToPrefix(prefix []byte, owner string, dseq uint64, gseq, oseq uint32, provider string) ([]byte, error) { - buf := bytes.NewBuffer(prefix) - - if len(owner) == 0 { - return buf.Bytes(), nil - } - - if _, err := buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(owner))); err != nil { - return nil, err - } - - if dseq == 0 { - return buf.Bytes(), nil - } - if err := binary.Write(buf, binary.BigEndian, dseq); err != nil { - return nil, err - } - - if gseq == 0 { - return buf.Bytes(), nil - } - if err := binary.Write(buf, binary.BigEndian, gseq); err != nil { - return nil, err - } - - if oseq == 0 { - return buf.Bytes(), nil - } - if err := binary.Write(buf, binary.BigEndian, oseq); err != nil { - return nil, err - } - - if len(provider) == 0 { - return buf.Bytes(), nil - } - - if _, err := buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(provider))); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -func OrderPrefixFromFilter(f types.OrderFilters) ([]byte, error) { - return filterToPrefix(types.OrderPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, "") -} - -func LeasePrefixFromFilter(f types.LeaseFilters) ([]byte, bool, error) { - prefix, err := filterToPrefix(types.LeasePrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) - return prefix, false, err -} - -func BidPrefixFromFilter(f types.BidFilters) ([]byte, error) { - return filterToPrefix(types.BidPrefix(), f.Owner, f.DSeq, f.GSeq, f.OSeq, f.Provider) -} - -func OrderKey(id types.OrderID) []byte { - buf := bytes.NewBuffer(types.OrderPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -func BidKey(id types.BidID) []byte { - buf := bytes.NewBuffer(types.BidPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Provider))) - return buf.Bytes() -} - -func LeaseKey(id types.LeaseID) []byte { - buf := bytes.NewBuffer(types.LeasePrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Provider))) - return buf.Bytes() -} - -func secondaryLeaseKeyByProvider(id types.LeaseID) []byte { - buf := bytes.NewBuffer(types.SecondaryLeasePrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Provider))) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -func SecondaryKeysForLease(id types.LeaseID) [][]byte { - return [][]byte{ - secondaryLeaseKeyByProvider(id), - } -} - -func OrdersForGroupPrefix(id dtypes.GroupID) []byte { - buf := bytes.NewBuffer(types.OrderPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - return buf.Bytes() -} - -func BidsForOrderPrefix(id types.OrderID) []byte { - buf := bytes.NewBuffer(types.BidPrefix()) - buf.Write(address.MustLengthPrefix(sdkutil.MustAccAddressFromBech32(id.Owner))) - if err := binary.Write(buf, binary.BigEndian, id.DSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.GSeq); err != nil { - panic(err) - } - if err := binary.Write(buf, binary.BigEndian, id.OSeq); err != nil { - panic(err) - } - return buf.Bytes() -} diff --git a/x/market/keeper/keys/v1beta3/key_test.go b/x/market/keeper/keys/v1beta3/key_test.go deleted file mode 100644 index ecac8320ec..0000000000 --- a/x/market/keeper/keys/v1beta3/key_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package v1beta3_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - types "github.com/akash-network/akash-api/go/node/market/v1beta3" - - _ "github.com/akash-network/node/testutil" - keys "github.com/akash-network/node/x/market/keeper/keys/v1beta3" -) - -func TestKeysAndSecondaryKeysFilter(t *testing.T) { - filter := types.LeaseFilters{ - Owner: "akash104fq56d9attl4m709h7mgx9lwqklnh05fhy5nu", - DSeq: 1, - GSeq: 2, - OSeq: 3, - Provider: "akash1vlaa09ytnl0hvu04wgs0d6zw5n6anjc3allk49", - State: types.LeaseClosed.String(), - } - - prefix, isSecondary, err := keys.LeasePrefixFromFilter(filter) - require.NoError(t, err) - require.False(t, isSecondary) - require.Equal(t, types.LeasePrefix(), prefix[0:2]) - - filter.Owner = "" - prefix, isSecondary, err = keys.LeasePrefixFromFilter(filter) - require.NoError(t, err) - require.False(t, isSecondary) - require.Equal(t, types.LeasePrefix(), prefix[0:2]) -} diff --git a/x/market/module.go b/x/market/module.go index c724c0c372..b17f9823ff 100644 --- a/x/market/module.go +++ b/x/market/module.go @@ -4,42 +4,36 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - v1beta1types "github.com/akash-network/akash-api/go/node/market/v1beta1" - v1beta2types "github.com/akash-network/akash-api/go/node/market/v1beta2" - v1beta3types "github.com/akash-network/akash-api/go/node/market/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - - utypes "github.com/akash-network/node/upgrades/types" - akeeper "github.com/akash-network/node/x/audit/keeper" - ekeeper "github.com/akash-network/node/x/escrow/keeper" - "github.com/akash-network/node/x/market/client/cli" - "github.com/akash-network/node/x/market/client/rest" - "github.com/akash-network/node/x/market/handler" - "github.com/akash-network/node/x/market/keeper" - "github.com/akash-network/node/x/market/simulation" + types "pkg.akt.dev/go/node/market/v1beta5" + + utypes "pkg.akt.dev/akashd/upgrades/types" + akeeper "pkg.akt.dev/akashd/x/audit/keeper" + ekeeper "pkg.akt.dev/akashd/x/escrow/keeper" + "pkg.akt.dev/akashd/x/market/client/cli" + "pkg.akt.dev/akashd/x/market/client/rest" + "pkg.akt.dev/akashd/x/market/handler" + "pkg.akt.dev/akashd/x/market/keeper" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModuleSimulation{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + // _ module.AppModuleSimulation = AppModuleSimulation{} ) // AppModuleBasic defines the basic application module used by the market module. @@ -60,9 +54,9 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { types.RegisterInterfaces(registry) - v1beta3types.RegisterInterfaces(registry) - v1beta2types.RegisterInterfaces(registry) - v1beta1types.RegisterInterfaces(registry) + // v1beta3types.RegisterInterfaces(registry) + // v1beta2types.RegisterInterfaces(registry) + // v1beta1types.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the market @@ -146,20 +140,20 @@ func (AppModule) Name() string { // RegisterInvariants registers module invariants func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} -// Route returns the message routing key for the market module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, handler.NewHandler(am.keepers)) -} +// // Route returns the message routing key for the market module. +// func (am AppModule) Route() sdk.Route { +// return sdk.NewRoute(types.RouterKey, handler.NewHandler(am.keepers)) +// } // QuerierRoute returns the market module's querier route name. func (am AppModule) QuerierRoute() string { return "" } -// LegacyQuerierHandler returns the sdk.Querier for market module -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} +// // LegacyQuerierHandler returns the sdk.Querier for market module +// func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { +// return nil +// } // RegisterServices registers the module's services func (am AppModule) RegisterServices(cfg module.Configurator) { @@ -228,30 +222,30 @@ func NewAppModuleSimulation( } } -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the staking module. -func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModuleSimulation) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for staking module's types -func (AppModuleSimulation) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { - // sdr[StoreKey] = simulation.DecodeStore -} - -// WeightedOperations returns the all the staking module operations with their respective weights. -func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return simulation.WeightedOperations(simState.AppParams, simState.Cdc, - am.akeeper, am.keepers) -} +// // AppModuleSimulation functions +// +// // GenerateGenesisState creates a randomized GenState of the staking module. +// func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { +// simulation.RandomizedGenState(simState) +// } +// +// // ProposalContents doesn't return any content functions for governance proposals. +// func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +// return nil +// } +// +// // RandomizedParams creates randomized staking param changes for the simulator. +// func (AppModuleSimulation) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { +// return nil +// } +// +// // RegisterStoreDecoder registers a decoder for staking module's types +// func (AppModuleSimulation) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { +// // sdr[StoreKey] = simulation.DecodeStore +// } +// +// // WeightedOperations returns the all the staking module operations with their respective weights. +// func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +// return simulation.WeightedOperations(simState.AppParams, simState.Cdc, +// am.akeeper, am.keepers) +// } diff --git a/x/market/query/client.go b/x/market/query/client.go index 189c67c719..c875be9676 100644 --- a/x/market/query/client.go +++ b/x/market/query/client.go @@ -1,7 +1,7 @@ package query import ( - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta4" ) // Client interface diff --git a/x/market/query/path.go b/x/market/query/path.go index d4dd876049..4042eab2d2 100644 --- a/x/market/query/path.go +++ b/x/market/query/path.go @@ -6,10 +6,9 @@ import ( "strconv" sdk "github.com/cosmos/cosmos-sdk/types" + v1 "pkg.akt.dev/go/node/market/v1" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" - - dpath "github.com/akash-network/node/x/deployment/query" + dpath "pkg.akt.dev/akashd/x/deployment/query" ) const ( @@ -33,7 +32,7 @@ func getOrdersPath(ofilters OrderFilters) string { } // OrderPath return order path of given order id for queries -func OrderPath(id types.OrderID) string { +func OrderPath(id v1.OrderID) string { return fmt.Sprintf("%s/%s", orderPath, orderParts(id)) } @@ -43,7 +42,7 @@ func getBidsPath(bfilters BidFilters) string { } // getBidPath return bid path of given bid id for queries -func getBidPath(id types.BidID) string { +func getBidPath(id v1.BidID) string { return fmt.Sprintf("%s/%s/%s", bidPath, orderParts(id.OrderID()), id.Provider) } @@ -53,61 +52,61 @@ func getLeasesPath(lfilters LeaseFilters) string { } // LeasePath return lease path of given lease id for queries -func LeasePath(id types.LeaseID) string { +func LeasePath(id v1.LeaseID) string { return fmt.Sprintf("%s/%s/%s", leasePath, orderParts(id.OrderID()), id.Provider) } -func orderParts(id types.OrderID) string { +func orderParts(id v1.OrderID) string { return fmt.Sprintf("%s/%v/%v/%v", id.Owner, id.DSeq, id.GSeq, id.OSeq) } // parseOrderPath returns orderID details with provided queries, and return // error if occurred due to wrong query -func parseOrderPath(parts []string) (types.OrderID, error) { +func parseOrderPath(parts []string) (v1.OrderID, error) { if len(parts) < 4 { - return types.OrderID{}, ErrInvalidPath + return v1.OrderID{}, ErrInvalidPath } did, err := dpath.ParseGroupPath(parts[0:3]) if err != nil { - return types.OrderID{}, err + return v1.OrderID{}, err } oseq, err := strconv.ParseUint(parts[3], 10, 32) if err != nil { - return types.OrderID{}, err + return v1.OrderID{}, err } - return types.MakeOrderID(did, uint32(oseq)), nil + return v1.MakeOrderID(did, uint32(oseq)), nil } // parseBidPath returns bidID details with provided queries, and return // error if occurred due to wrong query -func parseBidPath(parts []string) (types.BidID, error) { +func parseBidPath(parts []string) (v1.BidID, error) { if len(parts) < 5 { - return types.BidID{}, ErrInvalidPath + return v1.BidID{}, ErrInvalidPath } oid, err := parseOrderPath(parts[0:4]) if err != nil { - return types.BidID{}, err + return v1.BidID{}, err } provider, err := sdk.AccAddressFromBech32(parts[4]) if err != nil { - return types.BidID{}, err + return v1.BidID{}, err } - return types.MakeBidID(oid, provider), nil + return v1.MakeBidID(oid, provider), nil } // ParseLeasePath returns leaseID details with provided queries, and return // error if occurred due to wrong query -func ParseLeasePath(parts []string) (types.LeaseID, error) { +func ParseLeasePath(parts []string) (v1.LeaseID, error) { bid, err := parseBidPath(parts) if err != nil { - return types.LeaseID{}, err + return v1.LeaseID{}, err } - return types.MakeLeaseID(bid), nil + return v1.MakeLeaseID(bid), nil } diff --git a/x/market/query/rawclient.go b/x/market/query/rawclient.go index da2e6c713b..7857abf59e 100644 --- a/x/market/query/rawclient.go +++ b/x/market/query/rawclient.go @@ -4,18 +4,17 @@ import ( "fmt" sdkclient "github.com/cosmos/cosmos-sdk/client" - - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + v1 "pkg.akt.dev/go/node/market/v1" ) // RawClient interface type RawClient interface { Orders(filters OrderFilters) ([]byte, error) - Order(id types.OrderID) ([]byte, error) + Order(id v1.OrderID) ([]byte, error) Bids(filters BidFilters) ([]byte, error) - Bid(id types.BidID) ([]byte, error) + Bid(id v1.BidID) ([]byte, error) Leases(filters LeaseFilters) ([]byte, error) - Lease(id types.LeaseID) ([]byte, error) + Lease(id v1.LeaseID) ([]byte, error) } // NewRawClient creates a raw client instance with provided context and key @@ -36,7 +35,7 @@ func (c *rawclient) Orders(ofilters OrderFilters) ([]byte, error) { return buf, nil } -func (c *rawclient) Order(id types.OrderID) ([]byte, error) { +func (c *rawclient) Order(id v1.OrderID) ([]byte, error) { buf, _, err := c.ctx.QueryWithData(fmt.Sprintf("custom/%s/%s", c.key, OrderPath(id)), nil) if err != nil { return []byte{}, err @@ -52,7 +51,7 @@ func (c *rawclient) Bids(bfilters BidFilters) ([]byte, error) { return buf, nil } -func (c *rawclient) Bid(id types.BidID) ([]byte, error) { +func (c *rawclient) Bid(id v1.BidID) ([]byte, error) { buf, _, err := c.ctx.QueryWithData(fmt.Sprintf("custom/%s/%s", c.key, getBidPath(id)), nil) if err != nil { return []byte{}, err @@ -68,7 +67,7 @@ func (c *rawclient) Leases(lfilters LeaseFilters) ([]byte, error) { return buf, nil } -func (c *rawclient) Lease(id types.LeaseID) ([]byte, error) { +func (c *rawclient) Lease(id v1.LeaseID) ([]byte, error) { buf, _, err := c.ctx.QueryWithData(fmt.Sprintf("custom/%s/%s", c.key, LeasePath(id)), nil) if err != nil { return []byte{}, err diff --git a/x/market/query/types.go b/x/market/query/types.go index 2087a20ec8..812199c05c 100644 --- a/x/market/query/types.go +++ b/x/market/query/types.go @@ -3,7 +3,7 @@ package query import ( sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta4" ) type ( diff --git a/x/market/simulation/genesis.go b/x/market/simulation/genesis.go index f6cf09d027..a34e7a6829 100644 --- a/x/market/simulation/genesis.go +++ b/x/market/simulation/genesis.go @@ -3,8 +3,8 @@ package simulation import ( "github.com/cosmos/cosmos-sdk/types/module" - dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + dtypes "pkg.akt.dev/go/node/deployment/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta5" ) var minDeposit, _ = dtypes.DefaultParams().MinDepositFor("uakt") diff --git a/x/market/simulation/operations.go b/x/market/simulation/operations.go index 7fec0fd7ae..ad0155961d 100644 --- a/x/market/simulation/operations.go +++ b/x/market/simulation/operations.go @@ -7,19 +7,16 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/simapp/helpers" sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/simulation" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta4" - appparams "github.com/akash-network/node/app/params" - testsim "github.com/akash-network/node/testutil/sim" - keepers "github.com/akash-network/node/x/market/handler" + appparams "pkg.akt.dev/akashd/app/params" + testsim "pkg.akt.dev/akashd/testutil/sim" + keepers "pkg.akt.dev/akashd/x/market/handler" ) // Simulation operation weights constants diff --git a/x/market/simulation/utils.go b/x/market/simulation/utils.go index 5a9f60be88..6addbfb29c 100644 --- a/x/market/simulation/utils.go +++ b/x/market/simulation/utils.go @@ -3,11 +3,11 @@ package simulation import ( sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/market/v1beta4" + types "pkg.akt.dev/go/node/market/v1beta4" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" + ptypes "pkg.akt.dev/go/node/provider/v1beta3" - keepers "github.com/akash-network/node/x/market/handler" + keepers "pkg.akt.dev/akashd/x/market/handler" ) func getOrdersWithState(ctx sdk.Context, ks keepers.Keepers, state types.Order_State) []types.Order { diff --git a/x/provider/alias.go b/x/provider/alias.go index e67402a720..fd92c665ca 100644 --- a/x/provider/alias.go +++ b/x/provider/alias.go @@ -1,9 +1,9 @@ package provider import ( - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" - "github.com/akash-network/node/x/provider/keeper" + "pkg.akt.dev/akashd/x/provider/keeper" ) const ( diff --git a/x/provider/client/cli/cli_test.go b/x/provider/client/cli/cli_test.go index a6e8ceffab..0140d7bd61 100644 --- a/x/provider/client/cli/cli_test.go +++ b/x/provider/client/cli/cli_test.go @@ -10,11 +10,13 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/network" - "github.com/akash-network/node/x/provider/client/cli" + "pkg.akt.dev/go/cli" + + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/network" + pcli "pkg.akt.dev/akashd/x/provider/client/cli" ) type IntegrationTestSuite struct { @@ -52,21 +54,21 @@ func (s *IntegrationTestSuite) TestProvider() { s.Require().NoError(err) // create deployment - _, err = cli.TxCreateProviderExec( + _, err = pcli.TxCreateProviderExec( val.ClientCtx, val.Address, providerPath, - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s=true", cli.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", cli.FlagBroadcastMode, cli.BroadcastBlock), + fmt.Sprintf("--%s=%s", cli.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", cli.DefaultGasLimit), ) s.Require().NoError(err) s.Require().NoError(s.network.WaitForNextBlock()) // test query providers - resp, err := cli.QueryProvidersExec(val.ClientCtx.WithOutputFormat("json")) + resp, err := pcli.QueryProvidersExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) out := &types.QueryProvidersResponse{} @@ -78,7 +80,7 @@ func (s *IntegrationTestSuite) TestProvider() { // test query provider createdProvider := providers[0] - resp, err = cli.QueryProviderExec(val.ClientCtx.WithOutputFormat("json"), createdProvider.Owner) + resp, err = pcli.QueryProviderExec(val.ClientCtx.WithOutputFormat("json"), createdProvider.Owner) s.Require().NoError(err) var provider types.Provider @@ -87,12 +89,12 @@ func (s *IntegrationTestSuite) TestProvider() { s.Require().Equal(createdProvider, provider) // test updating provider - _, err = cli.TxUpdateProviderExec( + _, err = pcli.TxUpdateProviderExec( val.ClientCtx, val.Address, providerPath2, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -100,7 +102,7 @@ func (s *IntegrationTestSuite) TestProvider() { s.Require().NoError(s.network.WaitForNextBlock()) - resp, err = cli.QueryProviderExec(val.ClientCtx.WithOutputFormat("json"), createdProvider.Owner) + resp, err = pcli.QueryProviderExec(val.ClientCtx.WithOutputFormat("json"), createdProvider.Owner) s.Require().NoError(err) var providerV2 types.Provider diff --git a/x/provider/client/cli/grpc_rest_test.go b/x/provider/client/cli/grpc_rest_test.go index 513405d458..6517152da1 100644 --- a/x/provider/client/cli/grpc_rest_test.go +++ b/x/provider/client/cli/grpc_rest_test.go @@ -8,14 +8,16 @@ import ( "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/client/flags" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" - sdkrest "github.com/cosmos/cosmos-sdk/types/rest" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + "pkg.akt.dev/go/cli" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/network" - "github.com/akash-network/node/x/provider/client/cli" + types "pkg.akt.dev/go/node/provider/v1beta4" + + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/network" + pcli "pkg.akt.dev/akashd/x/provider/client/cli" ) type GRPCRestTestSuite struct { @@ -44,12 +46,12 @@ func (s *GRPCRestTestSuite) SetupSuite() { s.Require().NoError(err) // create deployment - _, err = cli.TxCreateProviderExec( + _, err = pcli.TxCreateProviderExec( val.ClientCtx, val.Address, providerPath, fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, cli.BroadcastBlock), fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), ) @@ -58,7 +60,7 @@ func (s *GRPCRestTestSuite) SetupSuite() { s.Require().NoError(s.network.WaitForNextBlock()) // get provider - resp, err := cli.QueryProvidersExec(val.ClientCtx.WithOutputFormat("json")) + resp, err := pcli.QueryProvidersExec(val.ClientCtx.WithOutputFormat("json")) s.Require().NoError(err) out := &types.QueryProvidersResponse{} @@ -98,7 +100,7 @@ func (s *GRPCRestTestSuite) TestGetProviders() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) var providers types.QueryProvidersResponse @@ -146,7 +148,7 @@ func (s *GRPCRestTestSuite) TestGetProvider() { for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - resp, err := sdkrest.GetRequest(tc.url) + resp, err := sdktestutil.GetRequest(tc.url) s.Require().NoError(err) var out types.QueryProviderResponse diff --git a/x/provider/client/cli/query.go b/x/provider/client/cli/query.go index 1faca8fb1f..be44aacf06 100644 --- a/x/provider/client/cli/query.go +++ b/x/provider/client/cli/query.go @@ -1,14 +1,15 @@ package cli import ( + "github.com/spf13/cobra" + sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" - aclient "github.com/akash-network/node/client" + aclient "pkg.akt.dev/akashd/client" ) // GetQueryCmd returns the transaction commands for the provider module diff --git a/x/provider/client/cli/test_helpers.go b/x/provider/client/cli/test_helpers.go index b26de8e018..9a751940e7 100644 --- a/x/provider/client/cli/test_helpers.go +++ b/x/provider/client/cli/test_helpers.go @@ -7,7 +7,7 @@ import ( sdktest "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" ) const key string = types.StoreKey diff --git a/x/provider/client/cli/tx.go b/x/provider/client/cli/tx.go index d1a327d1ab..e258ccc59b 100644 --- a/x/provider/client/cli/tx.go +++ b/x/provider/client/cli/tx.go @@ -3,16 +3,18 @@ package cli import ( "fmt" - cltypes "github.com/akash-network/akash-api/go/node/client/types" + "github.com/spf13/cobra" + sdkclient "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + cltypes "pkg.akt.dev/go/node/client/types" + + types "pkg.akt.dev/go/node/provider/v1beta4" - aclient "github.com/akash-network/node/client" - "github.com/akash-network/node/x/provider/config" + aclient "pkg.akt.dev/akashd/client" + "pkg.akt.dev/akashd/x/provider/config" ) // GetTxCmd returns the transaction commands for provider module diff --git a/x/provider/client/rest/rest.go b/x/provider/client/rest/rest.go index e6cbc185ac..b12142106a 100644 --- a/x/provider/client/rest/rest.go +++ b/x/provider/client/rest/rest.go @@ -4,10 +4,11 @@ import ( "fmt" "net/http" - "github.com/akash-network/node/x/provider/query" "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/rest" + + "pkg.akt.dev/akashd/x/provider/query" + "github.com/gorilla/mux" ) diff --git a/x/provider/config/config.go b/x/provider/config/config.go index 97328c3ede..39ffc8f0ec 100644 --- a/x/provider/config/config.go +++ b/x/provider/config/config.go @@ -7,9 +7,8 @@ import ( "gopkg.in/yaml.v3" - ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3" - - types "github.com/akash-network/akash-api/go/node/types/v1beta3" + ptypes "pkg.akt.dev/go/node/provider/v1beta4" + tattr "pkg.akt.dev/go/node/types/attributes/v1" ) var ( @@ -18,13 +17,13 @@ var ( // Config is the struct that stores provider config type Config struct { - Host string `json:"host" yaml:"host"` - Info ptypes.ProviderInfo `json:"info" yaml:"info"` - Attributes types.Attributes `json:"attributes" yaml:"attributes"` + Host string `json:"host" yaml:"host"` + Info ptypes.Info `json:"info" yaml:"info"` + Attributes tattr.Attributes `json:"attributes" yaml:"attributes"` } // GetAttributes returns config attributes into key value pairs -func (c Config) GetAttributes() types.Attributes { +func (c Config) GetAttributes() tattr.Attributes { return c.Attributes } diff --git a/x/provider/genesis.go b/x/provider/genesis.go index 96985bf044..3a6a0122c8 100644 --- a/x/provider/genesis.go +++ b/x/provider/genesis.go @@ -3,13 +3,13 @@ package provider import ( "encoding/json" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" - "github.com/akash-network/node/x/provider/keeper" + "pkg.akt.dev/akashd/x/provider/keeper" ) // ValidateGenesis does validation check of the Genesis and returns error in case of failure diff --git a/x/provider/handler/handler.go b/x/provider/handler/handler.go index a9d97e16b5..8f10d88b13 100644 --- a/x/provider/handler/handler.go +++ b/x/provider/handler/handler.go @@ -4,10 +4,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" - mkeeper "github.com/akash-network/node/x/market/keeper" - "github.com/akash-network/node/x/provider/keeper" + mkeeper "pkg.akt.dev/akashd/x/market/keeper" + "pkg.akt.dev/akashd/x/provider/keeper" ) // NewHandler returns a handler for "provider" type messages. @@ -29,7 +29,7 @@ func NewHandler(keeper keeper.IKeeper, mkeeper mkeeper.IKeeper) sdk.Handler { return sdk.WrapServiceResult(ctx, res, err) default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized bank message type: %T", msg) + return nil, sdkerrors.ErrUnknownRequest.Wrapf("unrecognized bank message type: %T", msg) } } } diff --git a/x/provider/handler/handler_test.go b/x/provider/handler/handler_test.go index b7d65e8ddd..81163facc7 100644 --- a/x/provider/handler/handler_test.go +++ b/x/provider/handler/handler_test.go @@ -4,20 +4,21 @@ import ( "errors" "testing" + "github.com/stretchr/testify/require" + sdktestdata "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/stretchr/testify/require" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" - akashtypes "github.com/akash-network/akash-api/go/node/types/v1beta3" + akashtypes "pkg.akt.dev/go/node/types/attributes/v1" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - mkeeper "github.com/akash-network/node/x/market/keeper" - "github.com/akash-network/node/x/provider/handler" - "github.com/akash-network/node/x/provider/keeper" + "pkg.akt.dev/akashd/testutil" + "pkg.akt.dev/akashd/testutil/state" + mkeeper "pkg.akt.dev/akashd/x/market/keeper" + "pkg.akt.dev/akashd/x/provider/handler" + "pkg.akt.dev/akashd/x/provider/keeper" ) const ( @@ -67,13 +68,14 @@ func TestProviderCreate(t *testing.T) { require.NoError(t, err) t.Run("ensure event created", func(t *testing.T) { + ev, err := sdk.ParseTypedEvent(res.Events[0]) + require.NoError(t, err) - iev := testutil.ParseProviderEvent(t, res.Events) - require.IsType(t, types.EventProviderCreated{}, iev) + require.IsType(t, &types.EventProviderCreated{}, ev) - dev := iev.(types.EventProviderCreated) + dev := ev.(*types.EventProviderCreated) - require.Equal(t, msg.Owner, dev.Owner.String()) + require.Equal(t, msg.Owner, dev.Owner) }) res, err = suite.handler(suite.ctx, msg) @@ -88,7 +90,7 @@ func TestProviderCreateWithInfo(t *testing.T) { msg := &types.MsgCreateProvider{ Owner: testutil.AccAddress(t).String(), HostURI: testutil.ProviderHostname(t), - Info: types.ProviderInfo{ + Info: types.Info{ EMail: emailValid, Website: testutil.Hostname(t), }, @@ -99,13 +101,14 @@ func TestProviderCreateWithInfo(t *testing.T) { require.NoError(t, err) t.Run("ensure event created", func(t *testing.T) { + ev, err := sdk.ParseTypedEvent(res.Events[0]) + require.NoError(t, err) - iev := testutil.ParseProviderEvent(t, res.Events) - require.IsType(t, types.EventProviderCreated{}, iev) + require.IsType(t, &types.EventProviderCreated{}, ev) - dev := iev.(types.EventProviderCreated) + dev := ev.(*types.EventProviderCreated) - require.Equal(t, msg.Owner, dev.Owner.String()) + require.Equal(t, msg.Owner, dev.Owner) }) res, err = suite.handler(suite.ctx, msg) @@ -178,12 +181,14 @@ func TestProviderUpdateExisting(t *testing.T) { res, err := suite.handler(suite.ctx, updateMsg) t.Run("ensure event created", func(t *testing.T) { - iev := testutil.ParseProviderEvent(t, res.Events[1:]) - require.IsType(t, types.EventProviderUpdated{}, iev) + ev, err := sdk.ParseTypedEvent(res.Events[1]) + require.NoError(t, err) + + require.IsType(t, &types.EventProviderUpdated{}, ev) - dev := iev.(types.EventProviderUpdated) + dev := ev.(*types.EventProviderUpdated) - require.Equal(t, updateMsg.Owner, dev.Owner.String()) + require.Equal(t, updateMsg.Owner, dev.Owner) }) require.NoError(t, err) diff --git a/x/provider/handler/server.go b/x/provider/handler/server.go index 21cd71fe06..0720098a18 100644 --- a/x/provider/handler/server.go +++ b/x/provider/handler/server.go @@ -2,20 +2,21 @@ package handler import ( "context" - "fmt" + + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" - mkeeper "github.com/akash-network/node/x/market/keeper" - "github.com/akash-network/node/x/provider/keeper" + mkeeper "pkg.akt.dev/akashd/x/market/keeper" + "pkg.akt.dev/akashd/x/provider/keeper" ) var ( // ErrInternal defines registered error code for internal error - ErrInternal = sdkerrors.Register(types.ModuleName, 10, "internal error") + ErrInternal = errorsmod.Register(types.ModuleName, 10, "internal error") ) type msgServer struct { @@ -41,11 +42,11 @@ func (ms msgServer) CreateProvider(goCtx context.Context, msg *types.MsgCreatePr owner, _ := sdk.AccAddressFromBech32(msg.Owner) if _, ok := ms.provider.Get(ctx, owner); ok { - return nil, fmt.Errorf("%w: id: %s", types.ErrProviderExists, msg.Owner) + return nil, types.ErrProviderExists.Wrapf("id: %s", msg.Owner) } if err := ms.provider.Create(ctx, types.Provider(*msg)); err != nil { - return nil, sdkerrors.Wrapf(ErrInternal, "err: %v", err) + return nil, ErrInternal.Wrapf("err: %v", err) } return &types.MsgCreateProviderResponse{}, nil @@ -62,7 +63,7 @@ func (ms msgServer) UpdateProvider(goCtx context.Context, msg *types.MsgUpdatePr owner, _ := sdk.AccAddressFromBech32(msg.Owner) _, found := ms.provider.Get(ctx, owner) if !found { - return nil, fmt.Errorf("%w: id: %s", types.ErrProviderNotFound, msg.Owner) + return nil, types.ErrProviderNotFound.Wrapf("id: %s", msg.Owner) } if err := ms.provider.Update(ctx, types.Provider(*msg)); err != nil { @@ -85,5 +86,5 @@ func (ms msgServer) DeleteProvider(goCtx context.Context, msg *types.MsgDeletePr } // TODO: cancel leases - return nil, sdkerrors.Wrapf(ErrInternal, "NOTIMPLEMENTED") + return nil, ErrInternal.Wrap("NOTIMPLEMENTED") } diff --git a/x/provider/keeper/grpc_query.go b/x/provider/keeper/grpc_query.go index cd4825e1f4..65a5ebabb3 100644 --- a/x/provider/keeper/grpc_query.go +++ b/x/provider/keeper/grpc_query.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" ) // Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper diff --git a/x/provider/keeper/grpc_query_test.go b/x/provider/keeper/grpc_query_test.go index 649918aaac..af9a73264b 100644 --- a/x/provider/keeper/grpc_query_test.go +++ b/x/provider/keeper/grpc_query_test.go @@ -10,12 +10,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + "pkg.akt.dev/go/node/client/v1beta3/testutil" + types "pkg.akt.dev/go/node/provider/v1beta4" - "github.com/akash-network/node/app" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/provider/keeper" + "pkg.akt.dev/akashd/app" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/provider/keeper" ) type grpcTestSuite struct { diff --git a/x/provider/keeper/keeper.go b/x/provider/keeper/keeper.go index e42c07d685..16dbca5bca 100644 --- a/x/provider/keeper/keeper.go +++ b/x/provider/keeper/keeper.go @@ -2,14 +2,15 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" ) type IKeeper interface { Codec() codec.BinaryCodec - StoreKey() sdk.StoreKey + StoreKey() storetypes.StoreKey Get(ctx sdk.Context, id sdk.Address) (types.Provider, bool) Create(ctx sdk.Context, provider types.Provider) error WithProviders(ctx sdk.Context, fn func(types.Provider) bool) @@ -20,12 +21,12 @@ type IKeeper interface { // Keeper of the provider store type Keeper struct { - skey sdk.StoreKey + skey storetypes.StoreKey cdc codec.BinaryCodec } // NewKeeper creates and returns an instance for Provider keeper -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey) IKeeper { +func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey) IKeeper { return Keeper{ skey: skey, cdc: cdc, @@ -42,7 +43,7 @@ func (k Keeper) Codec() codec.BinaryCodec { } // StoreKey returns store key -func (k Keeper) StoreKey() sdk.StoreKey { +func (k Keeper) StoreKey() storetypes.StoreKey { return k.skey } @@ -77,10 +78,16 @@ func (k Keeper) Create(ctx sdk.Context, provider types.Provider) error { store.Set(key, k.cdc.MustMarshal(&provider)) - ctx.EventManager().EmitEvent( - types.EventProviderCreated{Owner: owner}.ToSDKEvent(), + err = ctx.EventManager().EmitTypedEvent( + &types.EventProviderCreated{ + Owner: owner.String(), + }, ) + if err != nil { + return err + } + return nil } @@ -88,7 +95,9 @@ func (k Keeper) Create(ctx sdk.Context, provider types.Provider) error { func (k Keeper) WithProviders(ctx sdk.Context, fn func(types.Provider) bool) { store := ctx.KVStore(k.skey) iter := store.Iterator(nil, nil) - defer iter.Close() + defer func() { + _ = iter.Close() + }() for ; iter.Valid(); iter.Next() { var val types.Provider k.cdc.MustUnmarshal(iter.Value(), &val) @@ -113,14 +122,20 @@ func (k Keeper) Update(ctx sdk.Context, provider types.Provider) error { } store.Set(key, k.cdc.MustMarshal(&provider)) - ctx.EventManager().EmitEvent( - types.EventProviderUpdated{Owner: owner}.ToSDKEvent(), + err = ctx.EventManager().EmitTypedEvent( + &types.EventProviderUpdated{ + Owner: owner.String(), + }, ) + if err != nil { + return err + } + return nil } // Delete delete a provider -func (k Keeper) Delete(ctx sdk.Context, id sdk.Address) { +func (k Keeper) Delete(_ sdk.Context, _ sdk.Address) { panic("TODO") } diff --git a/x/provider/keeper/keeper_test.go b/x/provider/keeper/keeper_test.go index 57ba051c94..85787a4db8 100644 --- a/x/provider/keeper/keeper_test.go +++ b/x/provider/keeper/keeper_test.go @@ -7,11 +7,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + "pkg.akt.dev/go/node/client/v1beta3/testutil" + types "pkg.akt.dev/go/node/provider/v1beta4" - "github.com/akash-network/node/testutil" - "github.com/akash-network/node/testutil/state" - "github.com/akash-network/node/x/provider/keeper" + "pkg.akt.dev/akashd/testutil/state" + "pkg.akt.dev/akashd/x/provider/keeper" ) func TestProviderCreate(t *testing.T) { diff --git a/x/provider/module.go b/x/provider/module.go index 777b545e0b..6e151c8481 100644 --- a/x/provider/module.go +++ b/x/provider/module.go @@ -4,40 +4,37 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" + // v1beta1types "pkg.akt.dev/go/node/provider/v1beta1" + // v1beta2types "pkg.akt.dev/go/node/provider/v1beta2" + // v1beta3types "pkg.akt.dev/go/node/provider/v1beta3" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - sim "github.com/cosmos/cosmos-sdk/types/simulation" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - v1beta1types "github.com/akash-network/akash-api/go/node/provider/v1beta1" - v1beta2types "github.com/akash-network/akash-api/go/node/provider/v1beta2" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" - - utypes "github.com/akash-network/node/upgrades/types" - mkeeper "github.com/akash-network/node/x/market/keeper" - "github.com/akash-network/node/x/provider/client/cli" - "github.com/akash-network/node/x/provider/client/rest" - "github.com/akash-network/node/x/provider/handler" - "github.com/akash-network/node/x/provider/keeper" - "github.com/akash-network/node/x/provider/simulation" + + types "pkg.akt.dev/go/node/provider/v1beta4" + + utypes "pkg.akt.dev/akashd/upgrades/types" + mkeeper "pkg.akt.dev/akashd/x/market/keeper" + "pkg.akt.dev/akashd/x/provider/client/cli" + "pkg.akt.dev/akashd/x/provider/client/rest" + "pkg.akt.dev/akashd/x/provider/handler" + "pkg.akt.dev/akashd/x/provider/keeper" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModuleSimulation{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + // _ module.AppModuleSimulation = AppModuleSimulation{} ) // AppModuleBasic defines the basic application module used by the provider module. @@ -58,8 +55,9 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // RegisterInterfaces registers the module's interface types func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { types.RegisterInterfaces(registry) - v1beta2types.RegisterInterfaces(registry) - v1beta1types.RegisterInterfaces(registry) + // v1beta3types.RegisterInterfaces(registry) + // v1beta2types.RegisterInterfaces(registry) + // v1beta1types.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the provider @@ -133,20 +131,20 @@ func (AppModule) Name() string { // RegisterInvariants registers module invariants func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} -// Route returns the message routing key for the provider module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, handler.NewHandler(am.keeper, am.mkeeper)) -} +// // Route returns the message routing key for the provider module. +// func (am AppModule) Route() sdk.Route { +// return sdk.NewRoute(types.RouterKey, handler.NewHandler(am.keeper, am.mkeeper)) +// } // QuerierRoute returns the provider module's querier route name. func (am AppModule) QuerierRoute() string { return "" } -// LegacyQuerierHandler returns the sdk.Querier for provider module -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} +// // LegacyQuerierHandler returns the sdk.Querier for provider module +// func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { +// return nil +// } // RegisterServices registers the module's services func (am AppModule) RegisterServices(cfg module.Configurator) { @@ -189,49 +187,3 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (am AppModule) ConsensusVersion() uint64 { return utypes.ModuleVersion(ModuleName) } - -// ____________________________________________________________________________ - -// AppModuleSimulation implements an application simulation module for the provider module. -type AppModuleSimulation struct { - keeper keeper.IKeeper - akeeper govtypes.AccountKeeper - bkeeper bankkeeper.Keeper -} - -// NewAppModuleSimulation creates a new AppModuleSimulation instance -func NewAppModuleSimulation(k keeper.IKeeper, akeeper govtypes.AccountKeeper, bkeeper bankkeeper.Keeper) AppModuleSimulation { - return AppModuleSimulation{ - keeper: k, - akeeper: akeeper, - bkeeper: bkeeper, - } -} - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the staking module. -func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModuleSimulation) RandomizedParams(r *rand.Rand) []sim.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for staking module's types -func (AppModuleSimulation) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - // sdr[StoreKey] = simulation.DecodeStore -} - -// WeightedOperations returns the all the staking module operations with their respective weights. -func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation { - return simulation.WeightedOperations(simState.AppParams, simState.Cdc, - am.akeeper, am.bkeeper, am.keeper) -} diff --git a/x/provider/query/types.go b/x/provider/query/types.go index e4331cc4e6..6a5a7be594 100644 --- a/x/provider/query/types.go +++ b/x/provider/query/types.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta4" ) type ( diff --git a/x/provider/simulation/genesis.go b/x/provider/simulation/genesis.go index 705e14eb65..d45606d7ae 100644 --- a/x/provider/simulation/genesis.go +++ b/x/provider/simulation/genesis.go @@ -3,7 +3,7 @@ package simulation import ( "github.com/cosmos/cosmos-sdk/types/module" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta3" ) // RandomizedGenState generates a random GenesisState for supply diff --git a/x/provider/simulation/operations.go b/x/provider/simulation/operations.go index de6c66fd7a..85018e7d77 100644 --- a/x/provider/simulation/operations.go +++ b/x/provider/simulation/operations.go @@ -6,20 +6,18 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/simapp/helpers" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/simulation" - types "github.com/akash-network/akash-api/go/node/provider/v1beta3" + types "pkg.akt.dev/go/node/provider/v1beta3" - appparams "github.com/akash-network/node/app/params" - testsim "github.com/akash-network/node/testutil/sim" - "github.com/akash-network/node/x/provider/config" - "github.com/akash-network/node/x/provider/keeper" + appparams "pkg.akt.dev/akashd/app/params" + testsim "pkg.akt.dev/akashd/testutil/sim" + "pkg.akt.dev/akashd/x/provider/config" + "pkg.akt.dev/akashd/x/provider/keeper" ) // Simulation operation weights constants diff --git a/x/staking/alias.go b/x/staking/alias.go index bd338c800e..5f90b72b96 100644 --- a/x/staking/alias.go +++ b/x/staking/alias.go @@ -1,9 +1,9 @@ package provider import ( - types "github.com/akash-network/akash-api/go/node/staking/v1beta3" + types "pkg.akt.dev/go/node/staking/v1beta3" - "github.com/akash-network/node/x/staking/keeper" + "pkg.akt.dev/akashd/x/staking/keeper" ) const ( diff --git a/x/staking/genesis.go b/x/staking/genesis.go index ff8385b988..5ed2ae5ba3 100644 --- a/x/staking/genesis.go +++ b/x/staking/genesis.go @@ -1,12 +1,12 @@ package provider import ( + abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" - types "github.com/akash-network/akash-api/go/node/staking/v1beta3" + types "pkg.akt.dev/go/node/staking/v1beta3" - "github.com/akash-network/node/x/staking/keeper" + "pkg.akt.dev/akashd/x/staking/keeper" ) // ValidateGenesis does validation check of the Genesis and returns error in case of failure diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index 5b2a5677f3..529ef4d0c4 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -2,15 +2,16 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - types "github.com/akash-network/akash-api/go/node/staking/v1beta3" + types "pkg.akt.dev/go/node/staking/v1beta3" ) type IKeeper interface { Codec() codec.BinaryCodec - StoreKey() sdk.StoreKey + StoreKey() storetypes.StoreKey SetParams(ctx sdk.Context, params types.Params) error GetParams(ctx sdk.Context) (params types.Params) MinCommissionRate(ctx sdk.Context) sdk.Dec @@ -18,13 +19,13 @@ type IKeeper interface { // Keeper of the provider store type Keeper struct { - skey sdk.StoreKey + skey storetypes.StoreKey cdc codec.BinaryCodec pspace paramtypes.Subspace } // NewKeeper creates and returns an instance for Provider keeper -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, pspace paramtypes.Subspace) IKeeper { +func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey, pspace paramtypes.Subspace) IKeeper { if !pspace.HasKeyTable() { pspace = pspace.WithKeyTable(types.ParamKeyTable()) } @@ -41,7 +42,7 @@ func (k Keeper) Codec() codec.BinaryCodec { return k.cdc } -func (k Keeper) StoreKey() sdk.StoreKey { +func (k Keeper) StoreKey() storetypes.StoreKey { return k.skey } diff --git a/x/staking/module.go b/x/staking/module.go index 6b0ad55fc1..d80462a433 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -18,11 +18,11 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" sim "github.com/cosmos/cosmos-sdk/types/simulation" - types "github.com/akash-network/akash-api/go/node/staking/v1beta3" + types "pkg.akt.dev/go/node/staking/v1beta3" - utypes "github.com/akash-network/node/upgrades/types" - "github.com/akash-network/node/x/staking/keeper" - "github.com/akash-network/node/x/staking/simulation" + utypes "pkg.akt.dev/akashd/upgrades/types" + "pkg.akt.dev/akashd/x/staking/keeper" + "pkg.akt.dev/akashd/x/staking/simulation" ) var ( diff --git a/x/staking/simulation/genesis.go b/x/staking/simulation/genesis.go index 214a7e2187..41cd4827a1 100644 --- a/x/staking/simulation/genesis.go +++ b/x/staking/simulation/genesis.go @@ -3,7 +3,7 @@ package simulation import ( "github.com/cosmos/cosmos-sdk/types/module" - types "github.com/akash-network/akash-api/go/node/staking/v1beta3" + types "pkg.akt.dev/go/node/staking/v1beta3" ) // RandomizedGenState generates a random GenesisState for supply diff --git a/x/staking/simulation/operations.go b/x/staking/simulation/operations.go index 4f41281156..ec5682fec2 100644 --- a/x/staking/simulation/operations.go +++ b/x/staking/simulation/operations.go @@ -5,7 +5,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" - "github.com/akash-network/node/x/staking/keeper" + "pkg.akt.dev/akashd/x/staking/keeper" ) // WeightedOperations returns all the operations from the module with their respective weights diff --git a/x/take/alias.go b/x/take/alias.go index eaacc2e318..fe7d111266 100644 --- a/x/take/alias.go +++ b/x/take/alias.go @@ -1,7 +1,7 @@ package take import ( - types "github.com/akash-network/akash-api/go/node/take/v1beta3" + types "pkg.akt.dev/go/node/take/v1" ) const ( diff --git a/x/take/genesis.go b/x/take/genesis.go index 56fe694907..ae36f13a10 100644 --- a/x/take/genesis.go +++ b/x/take/genesis.go @@ -3,11 +3,11 @@ package take import ( sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" - types "github.com/akash-network/akash-api/go/node/take/v1beta3" + types "pkg.akt.dev/go/node/take/v1" - "github.com/akash-network/node/x/take/keeper" + "pkg.akt.dev/akashd/x/take/keeper" ) // ValidateGenesis does validation check of the Genesis and return error incase of failure diff --git a/x/take/keeper/keeper.go b/x/take/keeper/keeper.go index db67cbaabd..34d6ff1366 100644 --- a/x/take/keeper/keeper.go +++ b/x/take/keeper/keeper.go @@ -2,15 +2,15 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - types "github.com/akash-network/akash-api/go/node/take/v1beta3" + types "pkg.akt.dev/go/node/take/v1" ) type IKeeper interface { - StoreKey() sdk.StoreKey + StoreKey() storetypes.StoreKey Codec() codec.BinaryCodec GetParams(ctx sdk.Context) (params types.Params) SetParams(ctx sdk.Context, params types.Params) @@ -19,13 +19,13 @@ type IKeeper interface { // Keeper of the deployment store type Keeper struct { - skey sdk.StoreKey + skey storetypes.StoreKey cdc codec.BinaryCodec pspace paramtypes.Subspace } // NewKeeper creates and returns an instance for deployment keeper -func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, pspace paramtypes.Subspace) IKeeper { +func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey, pspace paramtypes.Subspace) IKeeper { if !pspace.HasKeyTable() { pspace = pspace.WithKeyTable(types.ParamKeyTable()) } @@ -42,7 +42,7 @@ func (k Keeper) Codec() codec.BinaryCodec { return k.cdc } -func (k Keeper) StoreKey() sdk.StoreKey { +func (k Keeper) StoreKey() storetypes.StoreKey { return k.skey } diff --git a/x/take/module.go b/x/take/module.go index 8a5989655e..0527bb1cc3 100644 --- a/x/take/module.go +++ b/x/take/module.go @@ -2,33 +2,29 @@ package take import ( "encoding/json" - "math/rand" - - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - sim "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/spf13/cobra" + "fmt" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" - abci "github.com/tendermint/tendermint/abci/types" + "github.com/spf13/cobra" + abci "github.com/cometbft/cometbft/abci/types" + + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/gogo/protobuf/grpc" - "github.com/pkg/errors" + "github.com/cosmos/gogoproto/grpc" - "github.com/akash-network/node/x/take/keeper" - "github.com/akash-network/node/x/take/simulation" + types "pkg.akt.dev/go/node/take/v1" - types "github.com/akash-network/akash-api/go/node/take/v1beta3" + "pkg.akt.dev/akashd/x/take/keeper" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModuleSimulation{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the provider module. @@ -67,7 +63,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo err := cdc.UnmarshalJSON(bz, &data) if err != nil { - return errors.Errorf("failed to unmarshal %s genesis state: %v", types.ModuleName, err) + return fmt.Errorf("failed to unmarshal %s genesis state: %v", types.ModuleName, err) } return ValidateGenesis(&data) @@ -122,21 +118,16 @@ func (AppModule) Name() string { // RegisterInvariants registers module invariants func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} -// Route returns the message routing key for the take module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, nil) -} +// // Route returns the message routing key for the take module. +// func (am AppModule) Route() sdk.Route { +// return sdk.NewRoute(types.RouterKey, nil) +// } // QuerierRoute returns the take module's querier route name. func (am AppModule) QuerierRoute() string { return types.ModuleName } -// LegacyQuerierHandler returns the sdk.Querier for take module -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers the module's servicess func (am AppModule) RegisterServices(cfg module.Configurator) { } @@ -174,44 +165,3 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (am AppModule) ConsensusVersion() uint64 { return 2 } - -// ____________________________________________________________________________ - -// AppModuleSimulation implements an application simulation module for the take module. -type AppModuleSimulation struct { - keeper keeper.IKeeper -} - -// NewAppModuleSimulation creates a new AppModuleSimulation instance -func NewAppModuleSimulation(k keeper.IKeeper) AppModuleSimulation { - return AppModuleSimulation{ - keeper: k, - } -} - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the staking module. -func (AppModuleSimulation) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModuleSimulation) ProposalContents(_ module.SimulationState) []sim.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized staking param changes for the simulator. -func (AppModuleSimulation) RandomizedParams(r *rand.Rand) []sim.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for staking module's types -func (AppModuleSimulation) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - -} - -// WeightedOperations returns the all the staking module operations with their respective weights. -func (am AppModuleSimulation) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation { - return nil -} diff --git a/x/take/simulation/genesis.go b/x/take/simulation/genesis.go index ef389922a5..28a40f7e6f 100644 --- a/x/take/simulation/genesis.go +++ b/x/take/simulation/genesis.go @@ -1,8 +1,9 @@ package simulation import ( - types "github.com/akash-network/akash-api/go/node/take/v1beta3" "github.com/cosmos/cosmos-sdk/types/module" + + types "pkg.akt.dev/go/node/take/v1" ) // RandomizedGenState generates a random GenesisState for supply